User:Liangent/cat-redir

Copying from Mentorship programs/Possible projects:

This is one of the oldest and most voted MediaWiki feature requests. MediaWiki has a feature called redirects where one page can redirect to another. However they do not work for categories. In the ideal system, if Category A redirects to B, and someone puts page foo in category A, then the page should show up in category B. If Someone changes Category A to redirect to Category C, all the pages put in category C have to have their links moved from Category A to Category B.

This project would involve several of the "core" components of core MediaWiki including the, the database schema, and class. However it is quite self contained. This project would also be quite beneficial to several wiki projects, especially multilingual projects like Wikimedia Commons.

Skills: PHP. SQL would be helpful.

Mentors: Brian Wolff.

Technical notes

 * categorylinks table must be updated on redirection. Don't try to merge category contents on display - otherwise it breaks sorting and/or makes category view expensive.

Things to consider

 * Redirect creation and removals.
 * Edits adding and removing pages from / to redirected categories.
 * Redirects from category to other pages (and the other way) should be forbidden.
 * Handle existing redirects correctly (with a maintence script?), including:
 * Currently non-working category redirects used as shortcuts (see zh:CAT:CSD, where CAT is a namespace alias of Category).
 * Cross-namespace redirects.
 * The current limitation of 'move' on categories should be lifted, with proper redirect handling.
 * It looks nasty that we need to re-parse every page in the (former) target category if a redirect is removed (changed to non-redirect or deleted).
 * Otherwise it's unable to identify exact category names specified by user (in wikitext).
 * Or add a column in categorylinks called 'cl_to_plain' to store the name specified by user?
 * This can be also useful for LanguageConverter-converted category names...
 * Double redirects (doesn't need to implement it but the system shouldn't explode when some people create them).
 * In conjunction with my chinese-collation branch: 44667.
 * A better UI to create / edit redirects (as a generic issue instead of a category-specific one).
 * The case that a redirect is changed again when the previous redirect change is being processed must be check correctly.
 * A FIFO job queue *MIGHT* (but doesn't always) help.
 * Extension:Renameuser suffers the same issue but its number of users is really limited (normally beaurecrats only) so we can just tell them not to create such cases.
 * Rendering of pages placed in redirected categories (which name to show? with what style? italic? red when redirect target is missing?).
 * Parser functions such as { {PAGESINCATEGORY: }}, especially when applied on redirected category names.
 * Compatibility of existing extensions (Extension:CategoryTree, Extension:DynamicPageList, etc.).
 * Solution to this issue might be useful for LanguageConverter too (there's something similar to category redirects in LanguageConverter already, see above).

Timeline

 * Before mid-term: have initial coding work done.
 * Mid-term: have code submitted for review (by others), writing mid-term evaluations.
 * After mid-term: have it deployed on various test wikis (and / or mw.org), test and fix problems.
 * Before final: have it deployed on other wikis.
 * Final: write report based on its working status on live sites.