jenkins-bot has submitted this change and it was merged.

Change subject: Make spreadAnyEditBlock() calls respect read-only mode
......................................................................


Make spreadAnyEditBlock() calls respect read-only mode

Bug: T129968
Change-Id: Ib391bd880fa9e04777a355634035183065de5b0a
---
M includes/EditPage.php
M includes/user/User.php
2 files changed, 10 insertions(+), 6 deletions(-)

Approvals:
  Gilles: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/EditPage.php b/includes/EditPage.php
index 3268700..520ca57 100644
--- a/includes/EditPage.php
+++ b/includes/EditPage.php
@@ -530,11 +530,12 @@
                if ( $permErrors ) {
                        wfDebug( __METHOD__ . ": User can't edit\n" );
                        // Auto-block user's IP if the account was "hard" 
blocked
-                       $user = $wgUser;
-                       DeferredUpdates::addCallableUpdate( function() use ( 
$user ) {
-                               $user->spreadAnyEditBlock();
-                       } );
-
+                       if ( !wfReadOnly() ) {
+                               $user = $wgUser;
+                               DeferredUpdates::addCallableUpdate( function () 
use ( $user ) {
+                                       $user->spreadAnyEditBlock();
+                               } );
+                       }
                        $this->displayPermissionsError( $permErrors );
 
                        return;
@@ -1735,7 +1736,9 @@
 
                if ( $wgUser->isBlockedFrom( $this->mTitle, false ) ) {
                        // Auto-block user's IP if the account was "hard" 
blocked
-                       $wgUser->spreadAnyEditBlock();
+                       if ( !wfReadOnly() ) {
+                               $wgUser->spreadAnyEditBlock();
+                       }
                        # Check block state against master, thus 'false'.
                        $status->setResult( false, 
self::AS_BLOCKED_PAGE_FOR_USER );
                        return $status;
diff --git a/includes/user/User.php b/includes/user/User.php
index 09124bf..831966e 100644
--- a/includes/user/User.php
+++ b/includes/user/User.php
@@ -3989,6 +3989,7 @@
                if ( $this->isLoggedIn() && $this->isBlocked() ) {
                        return $this->spreadBlock();
                }
+
                return false;
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/278223
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib391bd880fa9e04777a355634035183065de5b0a
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Gilles <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to