- $dbr = wfGetDB( DB_SLAVE );
- $table = array( 'user' );
- $conds = array( 'user_id' => $usersToQuery );
- $fields = array( 'user_name', 'user_real_name', 'user_registration', 'user_id' );
+ $dbr = wfGetDB( DB_REPLICA );
+ $tables = [ 'user' ];
+ $conds = [ 'user_id' => $usersToQuery ];
+ $fields = [ 'user_name', 'user_real_name', 'user_registration', 'user_id' ];
+ $joinConds = [];
+
+ if ( $wgActorTableSchemaMigrationStage > MIGRATION_OLD ) {
+ $tables[] = 'actor';
+ $fields[] = 'actor_id';
+ $joinConds['actor'] = [
+ $wgActorTableSchemaMigrationStage === MIGRATION_NEW ? 'JOIN' : 'LEFT JOIN',
+ [ 'actor_user = user_id' ]
+ ];
+ }