Commons:CategoryRedirectBot
This is a functional specification for a pywikipediabot. Filnik is working on it.
Introduction
[edit]Wikimedia Commons is all about images. To find images, metadata has to be added. Categories are a very important part of the metadata. One of the problems with categories is that although they can be redirected to another category, this does not mean that the content of the source category is moved to the redirect target. Worse even, content that ends up in a redirected category disappears, as users will always end up in the redirect target where in small text the name of the redirected category is shown.
One of the solutions that has been used on Commons is the template {{Category redirect}} (also {{Seecat}}). It serves as a soft redirect. This template routes a user to the redirect target, so that the content stays visible. A drawback is that a user needs more clicks to get to the content he wants to see.
Both methods (hard redirection/soft redirection) have their drawbacks. A bot may a provide a solution to some of these issues. Ideally {{Category redirect}} will no longer be used, as the bot will take care of recategorising media that have been placed in a category containing {{Category redirect}} or a redirected category. {{Category redirect}} should be phased out and category redirection can be used as easily as redirection in the main namespace.
Functional specifications
[edit]General
[edit]- The bot should be written in pywikipediabot (python)
- The bot should be licensed with the same license as pywikipediabot (MIT) so it can be added to the bot framework
Workings
[edit]The bot has the following tasks:
- Recategorise objects inside objects inside namespace Category: on which the templates {{Category redirect|target}} and {{seecat|target}} have been placed to Category target, obiding below condition(s)
- Recategorise objects inside objects inside namespace Category which have been redirected to another object inside namespace Category, obiding below condition(s)
- Replace a page in the namespace Category containing a soft redirect with a hard redirect and add the category page to Category:Hash mark redirected categories
- Report the Categories (using redirect=no) where the below condition(s) have not been met, so manual review can be done at Commons:Redirected categories with content. Categories that are already on Commons:Redirected categories with content, should not be reported again. A sub heading should be created for each bot run.
Conditions
[edit]- For actual recategorisation to be performed, a Commons administrator must have made the last edit to the page in the namespace Category. This is to prevent that a vandal (soft) redirects a few important categories for which the objects are moved without checking.
- A 'trusted user list at Commons:CategoryRedirectBot/CheckPage should be supported. This is a bulleted list containg a specified link to a user page.
Edit summaries
[edit]- For category move: Bot: Moving from Source to Target (redirected category)
- For category redirection: Bot: Replacing soft redirect by hard redirect
- For logging on Commons:Redirected categories with content: Bot: reporting redirected categories to be verified
Running the bot
[edit]The bot should be run at least once every week, preferably daily, depending on run time and resource usage. To run, a user does not have to be a Commons admin. Any admin can take care of the list on Commons:Redirected categories with content.
Implementation
[edit]Currently we have two implementations (not exactly following the functional specifications). Both implementations implement a cooldown period of a week to prevent vandalism.
- commons_category_redirect.py - Commons specific implementation by Multichill
- category_redirect.py - General implementation by R'n'B
Both SieBot and RussBot run on a regular basis to keep Category:Non-empty category redirects clean.