- // Add item author relations...
- $userIds = $userIPs = array();
- $sres = $db->select( 'logging',
- array( 'log_user', 'log_user_text' ),
- array( 'log_id' => $items )
- );
- foreach ( $sres as $srow ) {
- if ( $srow->log_user > 0 ) {
- $userIds[] = intval( $srow->log_user );
- } elseif ( IP::isIPAddress( $srow->log_user_text ) ) {
- $userIPs[] = $srow->log_user_text;
+ // Query item author relations...
+ $fields = [];
+ if ( $wgActorTableSchemaMigrationStage < MIGRATION_NEW ) {
+ $fields['userid'] = 'log_user';
+ $fields['username'] = 'log_user_text';
+ }
+ if ( $wgActorTableSchemaMigrationStage > MIGRATION_OLD ) {
+ $fields['actorid'] = 'log_actor';
+ }
+
+ $sres = $db->select( 'logging', $fields, [ 'log_id' => $items ], __METHOD__ );
+ } else {
+ continue;
+ }
+
+ // Add item author relations...
+ $userIds = $userIPs = $userActors = [];
+ foreach ( $sres as $srow ) {
+ if ( $wgActorTableSchemaMigrationStage < MIGRATION_NEW ) {
+ if ( $srow->userid > 0 ) {
+ $userIds[] = intval( $srow->userid );
+ } elseif ( $srow->username != '' ) {
+ $userIPs[] = $srow->username;