Page MenuHomePhabricator

All tracking categories should be automatically hidden categories
Open, Needs TriagePublic

Description

All or nearly all tracking categories are internal categories meant for editors, but still need manual intervention from editors to create them with __HIDDENCAT__. I can't think of any tracking categories that should not be hidden.

MediaWiki should automatically treat all tracking categories as hidden, without requiring editors to manually create/mark the category as such.

This was inspired by comments at https://en.wikinews.org/wiki/Category_talk:2020_Summer_Olympics

Event Timeline

A complicating factor is that the category name is parsed and people throw #switch in there. Maybe not an edge case that matters in practise though.

The TrackingCategories class already takes care of that, checking if the message result varies for each namespace. But before we started checking that on every page view I'd want to benchmark it and add caching if necessary.

Very naive measurement, getting the list of all tracking categories takes ~1s:

legoktm@mwmaint2002:~$ mwscript shell.php --wiki=enwiki
Psy Shell v0.10.5 (PHP 7.2.31-1+0~20200514.41+debian9~1.gbpe2a56b+wmf1+icu63 — cli) by Justin Hileman
>>> $tc=new TrackingCategories(MediaWiki\MediaWikiServices::getInstance()->getMainConfig());
=> TrackingCategories {#3150}
>>> $start=microtime(true);$tc->getTrackingCategories();$end=microtime(true);
=> 1628140981.6947
>>> $end-$start;
=> 0.95101594924927

I think that makes sense to store in APCu with a short TTL if we want to check it on each page view.

Alternatively, we could store the fact that these are tracking categories in ParserOutput so it doesn't need to be checked at page view time.