Add a missing check of $wgActorTableSchemaMigrationStage
authorBrad Jorsch <bjorsch@wikimedia.org>
Tue, 27 Feb 2018 21:08:02 +0000 (16:08 -0500)
committerBrad Jorsch <bjorsch@wikimedia.org>
Tue, 27 Feb 2018 21:08:02 +0000 (16:08 -0500)
We shouldn't be trying to update the table when it's MIGRATION_OLD.

Bug: T188437
Change-Id: Id5aae5eaafc36bf7e65009e67fe91619fb1df295

includes/user/User.php

index babb571..3102cfc 100644 (file)
@@ -4237,6 +4237,8 @@ class User implements IDBAccessObject, UserIdentity {
 
                $dbw = wfGetDB( DB_MASTER );
                $dbw->doAtomicSection( __METHOD__, function ( $dbw, $fname ) use ( $newTouched ) {
+                       global $wgActorTableSchemaMigrationStage;
+
                        $dbw->update( 'user',
                                [ /* SET */
                                        'user_name' => $this->mName,
@@ -4263,12 +4265,14 @@ class User implements IDBAccessObject, UserIdentity {
                                );
                        }
 
-                       $dbw->update(
-                               'actor',
-                               [ 'actor_name' => $this->mName ],
-                               [ 'actor_user' => $this->mId ],
-                               $fname
-                       );
+                       if ( $wgActorTableSchemaMigrationStage > MIGRATION_OLD ) {
+                               $dbw->update(
+                                       'actor',
+                                       [ 'actor_name' => $this->mName ],
+                                       [ 'actor_user' => $this->mId ],
+                                       $fname
+                               );
+                       }
                } );
 
                $this->mTouched = $newTouched;