Use WIS:addWatchBatchForUser in SpecialEditWatchlist
[lhc/web/wiklou.git] / includes / EditPage.php
index 3268700..b3bb07a 100644 (file)
@@ -530,11 +530,12 @@ class EditPage {
                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;
@@ -1520,7 +1521,7 @@ class EditPage {
                                // is if an extension hook aborted from inside ArticleSave.
                                // Render the status object into $this->hookError
                                // FIXME this sucks, we should just use the Status object throughout
-                               $this->hookError = '<div class="error">' . $status->getWikitext() .
+                               $this->hookError = '<div class="error">' . $status->getWikiText() .
                                        '</div>';
                                return true;
                }
@@ -1735,7 +1736,9 @@ class EditPage {
 
                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;