Defer spreadAnyEditBlock() post-send
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 27 Aug 2015 00:54:58 +0000 (17:54 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Thu, 27 Aug 2015 00:54:58 +0000 (17:54 -0700)
* No need for these to be perfectly synchronous

Bug: T92357
Change-Id: I6863960c8170ef4c3f2e356841b4086ac98f0f03

includes/EditPage.php
includes/specials/SpecialMovepage.php

index f3a41c4..85a3014 100644 (file)
@@ -527,7 +527,10 @@ class EditPage {
                if ( $permErrors ) {
                        wfDebug( __METHOD__ . ": User can't edit\n" );
                        // Auto-block user's IP if the account was "hard" blocked
-                       $wgUser->spreadAnyEditBlock();
+                       $user = $wgUser;
+                       DeferredUpdates::addCallableUpdate( function() use ( $user ) {
+                               $user->spreadAnyEditBlock();
+                       } );
 
                        $this->displayPermissionsError( $permErrors );
 
index e77479f..eb8a274 100644 (file)
@@ -104,7 +104,9 @@ class MovePageForm extends UnlistedSpecialPage {
                $permErrors = $this->oldTitle->getUserPermissionsErrors( 'move', $user );
                if ( count( $permErrors ) ) {
                        // Auto-block user's IP if the account was "hard" blocked
-                       $user->spreadAnyEditBlock();
+                       DeferredUpdates::addCallableUpdate( function() use ( $user ) {
+                               $user->spreadAnyEditBlock();
+                       } );
                        throw new PermissionsError( 'move', $permErrors );
                }