Page MenuHomePhabricator

Add option to update global edit count for all users with a local account in a specific wiki
Closed, ResolvedPublic

Description

MediaWiki's import functionality often leaves the edit counter in a wrong state. There is a core maintenance script (initEditCount) to fix the local counter, but that still leaves CA's global counter out of sync. In these situations it'd be useful to have a script in CA to re-calculate the global edit count for all users with a local account in a specific wiki.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Basically just need to call CentralAuthEditCounter::recalculate(). Could add a maint script around it, but it's straightforward enough that you can just do something like echo 'MW::srv()->get( 'CentralAuth.CentralAuthEditCounter' )->recalculate( MWCA::user( 'Foo' ) )' | run.php shell instead.

Maybe there should be a "reset editcount" hook or domain event in core that CA can listen to, but I'm not sure it's worth the effort.

Change #1216562 had a related patch set uploaded (by Majavah; author: Majavah):

[mediawiki/extensions/CentralAuth@master] Add script to reset edit count for all users in a specific wiki

https://gerrit.wikimedia.org/r/1216562

Change #1216562 merged by jenkins-bot:

[mediawiki/extensions/CentralAuth@master] Add script to reset edit count for all users in a specific wiki

https://gerrit.wikimedia.org/r/1216562

matmarex assigned this task to taavi.

(For future reference, this was motivated by T404573: Import tokwiki from Wikipesija.org, and the script was ran on tokwiki on 2025-12-09)