Wikipedia:Bots/Requests for approval/EarwigBot 8


 * The following discussion is an archived debate. Please do not modify it. To request review of this BRFA, please start a new section at WT:BRFA. The result of the discussion was Symbol keep vote.svg Approved.

EarwigBot 8
Operator:

Automatic or Manually assisted: Automatic, unsupervised

Programming language(s): Python

Source code available: Available at ~earwig/earwigbot; see categorydelinkerbot_run.py, but it's uncommented and ugly

Function overview: Delinking mainspace categories in declined Articles for creation submissions.

Links to relevant discussions (where appropriate): User_talk:The_Earwig/Archive_3 (old, but the basis for this task)

Edit period(s): Weekly

Estimated number of pages affected: Approximately 60 pages on the initial run, the bot will probably make about 5–10 edits per week, but it's difficult to tell.

Exclusion compliant (Y/N): Y

Already has a bot flag (Y/N): Y

Function details: The bot goes through the list of declined AfC submissions at Category:Declined AfC submissions and finds pages that have categories in them somewhere (via MySQL). It delinks the categories (per the thinking that Wikipedia-space pages should not use mainspace categories) by placing a colon in front of them, so  becomes. Some pages use templates that transclude categories; if so, the bot delinks those using. The bot is designed to be very careful and only delinks what is absolutely necessary. A code summary: Although the editing rate is low, this task is very difficult to do manually. I've tested the bot by running it in read-only mode, and didn't notice any problems. I think I've got most of the bugs out, so the task should be good to go. &mdash; The Earwig   (talk)  08:28, 6 March 2010 (UTC)
 * 1) Obtain a list of all categories used in AfC pages using MySQL.
 * 2) Obtain a list of all declined AfC submissions from Category:Declined AfC submissions.
 * 3) For each declined submission:
 * 4) If any of the categories (from #1) are in this submission, continue. Otherwise, move on to the next page.
 * 5) Load the page text.
 * 6) Delink all categories:   becomes.
 * 7) If there are still categories on the page that have not been delinked (transcluded through a template):
 * 8) Get a list of the remaining categories.
 * 9) Get a list of all templates in the submission.
 * 10) For each template in the page, excluding AFC submission:
 * 11) Get a list of all categories that could possibly be transcluded by the template (include subtemplates and parser functions).
 * 12) See if any of these categories are in the list of categories that have yet to be delinked.
 * 13) If so, delink the template by using.
 * 14) If there are still categories on the page, delink all templates except for reflist, templates beginning with "afc", and templates beginning with "cite" (bot couldn't find the specific template, so delink potential templates).
 * 15) Save the page.

Discussion
I've read over the sources, and it's a horrible mess; but with your assurances of tested code, let's see what happens when the real-world intervenes. Remember you are responsible for the actions of your bot. Josh Parris 00:08, 7 March 2010 (UTC)
 * Seems like a useful addition to me.  Chzz  ►  20:15, 6 March 2010 (UTC)
 * Agreed, while I think that AWB could be perfectly capable of handling this task, it certainly would be made easier by a bot command.  fetch  comms  ☛ 20:20, 6 March 2010 (UTC)
 * This is certainly a tedious task. A bot would be very welcome. Gosox(55)(55) 21:47, 6 March 2010 (UTC)
 * Performs fine in the tests, but it also nulls the infoboxes and other assorted templates. Not that it's particularly important, but seeing as it's designed to delink the categories and templates that add categories, this really isn't much of any matter.  fetch  comms  ☛ 01:16, 7 March 2010 (UTC)
 * It appears I've been mistaken, as those infoboxes were adding categories as well. Ah, nothing you can do about it, I suppose.  fetch  comms  ☛ 02:06, 7 March 2010 (UTC)

Overall, I'm pretty satisfied with the trial results. The delinking performed as expected in all cases, and the vast majority of the edits were very simple and didn't cause any problems. There were a few cases where the bot couldn't find the template to delink, so it delinked all templates. Most of these worked alright; an example that illustrates this is this edit. As you can see, the essential templates (AFC submission) were kept, while everything else was delinked, even if not absolutely necessary. The only page I see that was really messed up was this, but it wasn't a major screw up, only a little pointless. Besides, the actual category was delinked, so I don't see the problem. Another thing worth mentioning: is unusual when the template I'm delinking has multiple lines, see this for an example. The delinking works fine other than that bug; I'm not entirely sure what causes it, but I'm not too concerned about it. &mdash; The Earwig   (talk)  02:31, 7 March 2010 (UTC)
 * Cool, go forth earwigbot 8! Tim1357 (talk) 01:34, 8 March 2010 (UTC)


 * The above discussion is preserved as an archive of the debate. Please do not modify it. To request review of this BRFA, please start a new section at WT:BRFA.