I cannot find the thread where the bug was reported, so I am leaving this post here. If you know nothing about APIs, you don’t need to worry about this.

I found a temporary solution to the RC patrol images bug. You know, that bug that means some images get put in RC patrol and marked as unpatrolled, even though they are supposed to be autopatrolled. I was in correspondence with @JayneG and found a solution. @Gaurangprasad gave me the okay to use it, so I am going to share what needs to be done.

wikiHow, like many other MediaWiki wikis, has an API accessible to most users. The temporary solution to clearing those recent changes is to hit the wikiHow API with a bunch of POST requests; particularly, POST requests to mark an edit as patrolled.

What you do, is you keep on patrolling edits using the traditional RC patrol (not the RC patrol tool) until you get a “bad title” page. Look inside the URL, copy the rcid parameter from it, then proceed on to your code.

I am going to talk about a solution that works in the JavaScript F12 developer console, so please bear with me.

Take this code:

 $.get(mw.config.get("wgScriptPath") + "/api.php", {
   "action": "query",
   "format": "json",
   "meta": "tokens",
   "type": "patrol"
}).done(function(result) {
    if (result.error) {
        console.error(result.error.info);
    } else {
        $.post(mw.config.get("wgScriptPath") + "/api.php", {
           "action": "patrol",
           "format": "json",
           "rcid": RCID,
           "token": result.query.tokens.patroltoken
        }).done(function(result) {
            if (result.error) {
                console.error(result.error.info);
            } else {
                console.log(result);
            }
        });
    }
}); 

Replace “RCID” with the RCID you just copied, then check the response on the second line.

From there, you can kind of work backwards. Continue to monitor Recent Changes, decrementing the rcid parameter, one by one, until all the images are gone from Recent Changes.

You can check that you patrolled an image by looking inside the result, and seeing if you see the name of the image as the “title” parameter in the JSON returned.

I have went ahead and cleared all the images from recent changes. Hopefully this bug does not happen again, but it is good to have these instructions until a permanent fix is found.

If you would like to know more about this API call including how to do it in other languages, I recommend you take a look here: API:Patrol - MediaWiki . Oh, and please do one API call at a time, wikiHow rate limits the number of calls you can make per minute.

4 Likes

I have one other addition: You should only do this if there are no edits between the unpatrolled images. So first handle those, then handle the unpatrolled images. It is not quite easy to undo a patrol made on accident.

2 Likes

Thanks for finding this. I’m not good at APIs, so I’ll let someone else handle it, but thank you for finding a solution.

I know nothing about JS or APIs and have no idea what you just said, but good job?:sweat_smile::+1:

2 Likes

@Awesome_Aasim , would you have a layman’s-terminology/ELI5 explanation of how this works? I think I get it but I’m not totally sure, and I’d imagine the average person isn’t too familiar with how JavaScript or APIs work:slight_smile:

3 Likes

From what I understand it, ever revision has a unique “ID” which increments up. In traditional patrol, the “ID” is shown in the URL, and you can add “&action=markpatrolled” (or “&action=patrol”, I can never remember which one) to it to patrol a revision. (When you click “Mark Patrolled”, it sends this automatically). This is basically the “API”. The code here is just going through all of the unpatrolled IDs and patrolling them by adding that &action=markpatrolled/patrol to the URL, or something like that, until everything is patrolled.

I may be wrong, but this is what I think it’s doing.

2 Likes

*shrugs*Sounds legit.

It might be sending it through some way other than a URL, but I think it’s doing something like what I said.

I mentioned that most editors do not need to worry about this, but since you are all curious, I may give a little more background as to my solution.

APIs (Application Programming Interfaces) in a nutshell allow for interaction between a program and a website, without having to worry about all the human things like buttons or formatting. wikiHow, like many MediaWiki wikis, has a built-in API. This one is located at https://wikihow.com/api.php . MediaWiki has more comprehensive documentation on how to use the built-in API here .

I used a few JS variables that are built-in to MediaWiki (like mw.config.get("wgScriptPath") ), and jQuery Ajax functions to allow me to make calls to this API. This I mainly did from the F12 developer console. Of course, you can use basically any language or interface (like PHP, Java, Node.js, or C++) to interact with the API, I just used the F12 console because I was most familiar with it and it worked for me for the task at hand.

It took me a while to figure out MediaWiki APIs as well (I did not make my first real Wikipedia user script until like a year and a half ago), and I still look at the documentation from time to time. The average layperson does not really need to know this, but if you manage to figure out APIs and know what you are doing, then it does not hurt to test it out. I’d suggest experimenting with the API, especially with POST requests (as those have the potential to modify the wiki), on a dedicated test wiki (there are quite a few like https://test.wikipedia.org/ and https://wreckit-woodhouse.fandom.com/ ). The test wikis I linked also has a dedicated API testing interface ( API sandbox - Test Wikipedia and API sandbox | Wreck-It Woodhouse community | Fandom ) where you can experiment with different requests outside of a programming language. If you can figure out the MediaWiki API, it can be a powerful tool on not just wikiHow, but Wikipedia and virtually every MediaWiki wiki installation.

Of course, on wikiHow, I see the API as a last-resort thing, if all else fails. Some external tools like AutoWikiBrowser do interact with the wikiHow API, but generally from my understanding here, it is used very sparingly; when buttons are absent as in the RC patrol unpatrolled images bug, this may be the only way to rectify the problem. And most editors do not really need to worry about this.

I apologize if I did a terrible job at explaining, if you are still confused and are curious, you may want to do a search for “interact with API” to get an understanding of the basics. Tom Scott also has a video where he details how he interacted with the YouTube API in his program so that he can update the title to contain the view count in real time.

2 Likes

Lol same

#Complicated

I see. So in other words, it’s like using the Advanced Editor and working with the raw wikicode to get the job done instead of using the Guided Editor or other inbuilt tools.

3 Likes

Kind of, yes. Except that APIs do not worry about anything the human can see. In fact, an API is a place to send a bit of code, and get a bit of code back. Think of it like your computer talking to a website using only code, except it does not display anything on the page.

2 Likes