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
Approved.
Operator: The Earwig (talk · contribs)
Automatic or Manually assisted: Automatic, unsupervised
Programming language(s): Python
Source code available: Available at tools:~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#Categorized_submissions (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 [[Category:Foo]]
becomes [[:Category:Foo]]
. Some pages use templates that transclude categories; if so, the bot delinks those using {{tlx}}
. The bot is designed to be very careful and only delinks what is absolutely necessary. A code summary:
- Obtain a list of all categories used in AfC pages using MySQL.
- Obtain a list of all declined AfC submissions from Category:Declined AfC submissions.
- For each declined submission:
- If any of the categories (from #1) are in this submission, continue. Otherwise, move on to the next page.
- Load the page text.
- Delink all categories:
[[Category:Foo]]
becomes[[:Category:Foo]]
. - If there are still categories on the page that have not been delinked (transcluded through a template):
- Get a list of the remaining categories.
- Get a list of all templates in the submission.
- For each template in the page, excluding {{AFC submission}}:
- Get a list of all categories that could possibly be transcluded by the template (include subtemplates and parser functions).
- See if any of these categories are in the list of categories that have yet to be delinked.
- If so, delink the template by using
{{tlx}}
.
- 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).
- Save the page.
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. — The Earwig (talk) 08:28, 6 March 2010 (UTC)[reply]
Discussion
[edit]- Seems like a useful addition to me. Chzz ► 20:15, 6 March 2010 (UTC)[reply]
- Agreed, while I think that AWB could be perfectly capable of handling this task, it certainly would be made easier by a bot command. fetchcomms☛ 20:20, 6 March 2010 (UTC)[reply]
- This is certainly a tedious task. A bot would be very welcome. Gosox(55)(55) 21:47, 6 March 2010 (UTC)[reply]
Approved for trial (30 edits). Please provide a link to the relevant contributions and/or diffs when the trial is complete. 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)[reply]
- 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. fetchcomms☛ 01:16, 7 March 2010 (UTC)[reply]
- It appears I've been mistaken, as those infoboxes were adding categories as well. Ah, nothing you can do about it, I suppose. fetchcomms☛ 02:06, 7 March 2010 (UTC)[reply]
Trial complete. 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:
{{tlx}}
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. — The Earwig (talk) 02:31, 7 March 2010 (UTC)[reply]
Approved. Cool, go forth earwigbot 8! Tim1357 (talk) 01:34, 8 March 2010 (UTC)[reply]
- 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.