Last modified: 2014-09-24 00:00:12 UTC
Created attachment 5726 [details] Propose patch for the enhancement Special:UnusedCategories lists all unused categories in addition to category redirects like [[Category:Wikipedia category redirects]], which makes maintaining the rest of the categories a hard job. I made a patch to add a new magic word to MediaWiki (__USEDCAT__) to exclude those categories from Special:UnusedCategories. Thank you in advance.
Created attachment 5728 [details] Change the keyword This patch changes the keyword from (__USEDCAT__) to (__NOUNUSEDCAT__) per IRC discussion.
+ if ( isset( $this->mDoubleUnderscores['nounusedcat'] ) && $this->mTitle->getNamespace() == NS_CATEGORY ) { + $this->mOutput->setProperty( 'nounusedcat', 'y' ); + } I don't see any code to remove this property when it's been removed from the page -- does the Parser do that implicitly? I.e., if the magic word is removed, does it start showing up in UnusedCategories again? + AND pp_propname IS NULL + OR pp_propname != 'nounusedcat'"; I would prefer to see parentheses here: AND (... OR ...). Otherwise it's not clear to me that the logic is correct (I can't remember which way the association goes, and I'm sure I'm not the only one). 'hiddencat' => array( 1, '__HIDDENCAT__' ), + 'nounusedcat' => array( 1, '__NOUNUSEDCAT__' ), 'pagesincategory' => array( 1, 'PAGESINCATEGORY', 'PAGESINCAT' ), Indentation is wrong here. I'm not sure I like the name __NOUNUSEDCAT__. It's fairly confusing. Something like __SKIPUNUSED__ or __IGNOREUNUSED__ or something like that would be better -- maybe it really is unused, but we want to ignore that fact, is the point.
Created attachment 5731 [details] Change the keyword and the SQL query (In reply to comment #2) > I don't see any code to remove this property when it's been removed from the > page -- does the Parser do that implicitly? I.e., if the magic word is > removed, does it start showing up in UnusedCategories again? Yes, the parser do that implicitly. > I would prefer to see parentheses here: AND (... OR ...). Otherwise it's not > clear to me that the logic is correct (I can't remember which way the > association goes, and I'm sure I'm not the only one). Done. > Indentation is wrong here. Done.
Committed in r46196.
__IGNOREUNUSED__ is a pretty confusing name, it's not at all obvious what it means. I would tend to assume that it would ignore unused category members from display on the category page, or something.
How about __USEDCATEGORY__? That at least hints toward [[Special:UnusedCategories]].
How about __IGNOREUNUSEDCAT__? It's long but at least it's not confusing. Or what about __SKIPUNUSEDCAT__?
Reverted for now in r46395 pending working out a final name.
Maybe it needs to add SPECIAL somewhere, like __SKIPSPECIALUNUSEDCAT__.
What are the use-cases for this, anyway? Just category redirects?
Category redirects or any category that appears empty sometimes like Candidates for speedy deletion, so you can easily maintain other categories that is really unused.
Well, think up a name that Brion's okay with and I'll recommit it.
I hope he finds __SKIPSPECIALUNUSEDCAT__ ok.
Here many suggesstions, would you please pick a suitable one and commit it. __SKIPSPECIALUNUSEDCAT__ (last suggested one) __UNLISTUNUSEDCAT__ __HIDEUNUSEDCAT__
*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*
Adding "reviewed" keyword since it seems the patch was reviewed -- we're just waiting for someone to invent or choose the right name.