initEditCount: Join from user to actor to revision

Correct the join conditions used to find the current edit count for
a batch of users. Follows up b98f33c where the incorrect join order and
conditions were introduced as part of migration to QueryBuilder syntax.

Change-Id: I1841bb074b0f2be31e60a3cce3d62eb1b5999ad0
(cherry picked from commit 834891e01afa19cc1ecd973c04a453a9abb2d484)
This commit is contained in:
Bryan Davis 2025-02-25 17:49:31 -07:00 committed by Reedy
parent 10aee37b9e
commit be3c297852

View file

@ -72,8 +72,8 @@ class InitEditCount extends Maintenance {
$result = $dbr->newSelectQueryBuilder()
->select( [ 'user_id', 'user_editcount' => "COUNT(actor_rev_user.actor_user)" ] )
->from( 'user' )
->leftJoin( 'revision', 'rev', "user_id = actor_rev_user.actor_user" )
->join( 'actor', 'actor_rev_user', 'actor_rev_user.actor_id = rev_actor' )
->join( 'actor', 'actor_rev_user', 'user_id = actor_rev_user.actor_user' )
->leftJoin( 'revision', 'rev', 'actor_rev_user.actor_id = rev.rev_actor' )
->where( $dbr->expr( 'user_id', '>', $min )->and( 'user_id', '<=', $max ) )
->groupBy( 'user_id' )
->caller( __METHOD__ )->fetchResultSet();