Page MenuHomePhabricator

Excluding specific categories from Special:UnusedCategories
Closed, DuplicatePublic

Description

Author: ahmad.m.sherif

Description:
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.


Version: unspecified
Severity: enhancement

attachment unusedcategories.patch ignored as obsolete

Details

Reference
bz17145

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 10:26 PM
bzimport set Reference to bz17145.
bzimport added a subscriber: Unknown Object (MLST).

ahmad.m.sherif wrote:

Change the keyword

This patch changes the keyword from (USEDCAT) to (NOUNUSEDCAT) per IRC discussion.

attachment unusedcategories-2.patch ignored as obsolete

ayg wrote:

+ 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.

ahmad.m.sherif wrote:

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.

Attached:

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.

ayg wrote:

How about USEDCATEGORY? That at least hints toward [[Special:UnusedCategories]].

ahmad.m.sherif wrote:

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.

ahmad.m.sherif wrote:

Maybe it needs to add SPECIAL somewhere, like SKIPSPECIALUNUSEDCAT.

ayg wrote:

What are the use-cases for this, anyway? Just category redirects?

ahmad.m.sherif wrote:

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.

ayg wrote:

Well, think up a name that Brion's okay with and I'll recommit it.

ahmad.m.sherif wrote:

I hope he finds SKIPSPECIALUNUSEDCAT ok.

cipherswiki wrote:

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*

sumanah wrote:

Adding "reviewed" keyword since it seems the patch was reviewed -- we're just waiting for someone to invent or choose the right name.