Page MenuHomePhabricator

Write a maintenance script to refresh category member counts
Closed, ResolvedPublic


Currently there's no mechanism for refreshing category member counts. So certain categories, like say they have over 12,900 members, when in reality it has only about 3,000 members.

populateCategory.php is a bit of a brute-force approach (it recalculates everything, even categories whose counts are correct). We could do with another script that specifically recalculates wrong counts in the category table.

T85696 is about adding a way for users to invoke recounting when required.

Event Timeline

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

matthew.britton wrote:

Why admin-only?

TTO added a subscriber: TTO.

I'm working on a maintenance script to make this happen. T85696: Allow action=purge to recalculate the number of pages/subcats/files in a category would be nice, and finding out the reason for the drift would be even nicer, but a server-side script is better than nothing.

TTO renamed this task from Need a method to refresh category member counts to Write a maintenance script to refresh category member counts.Jan 24 2017, 12:22 PM
TTO updated the task description. (Show Details)

Change 333917 had a related patch set uploaded (by TTO):
New maintenance script to recalculate category membership counts

You didn't like the "Basing it on a percentage of pageviews (.01% of page views purge the count)" suggestion? The idea was that you could re-calculate the category membership counts when random.randint(1, 10000) % 5 == 0 or str(random.random()).endswith('5') or something like that. Obviously most requests don't hit MediaWiki, but enough do that this would probably work for at least popular categories.

Change 333917 merged by jenkins-bot:
[mediawiki/core@master] New maintenance script to recalculate category membership counts

TTO added a subscriber: aaron.

@MZMcBride: Oh, I see what you meant. It would be interesting to know what @aaron thinks of that idea. In any case, if you'd like to pursue it, you could file a separate task.