Show an appropiate message when the wiki is read only for some special pages.
authorPlatonides <platonides@users.mediawiki.org>
Sat, 20 Mar 2010 14:44:11 +0000 (14:44 +0000)
committerPlatonides <platonides@users.mediawiki.org>
Sat, 20 Mar 2010 14:44:11 +0000 (14:44 +0000)
Note that they show a successful message but wouldn't work since User::saveSettings()
silently fails (maybe the user object at memcached  could get updated?).

includes/specials/SpecialConfirmemail.php
includes/specials/SpecialMergeHistory.php
includes/specials/SpecialResetpass.php

index 372a574..7a26d74 100644 (file)
@@ -25,6 +25,12 @@ class EmailConfirmation extends UnlistedSpecialPage {
        function execute( $code ) {
                global $wgUser, $wgOut;
                $this->setHeaders();
+               
+               if ( wfReadOnly() ) {
+                       $wgOut->readOnlyPage();
+                       return;
+               }
+               
                if( empty( $code ) ) {
                        if( $wgUser->isLoggedIn() ) {
                                if( User::isValidEmailAddr( $wgUser->getEmail() ) ) {
@@ -121,6 +127,12 @@ class EmailInvalidation extends UnlistedSpecialPage {
 
        function execute( $code ) {
                $this->setHeaders();
+
+               if ( wfReadOnly() ) {
+                       $wgOut->readOnlyPage();
+                       return;
+               }
+               
                $this->attemptInvalidate( $code );
        }
 
index 59c924c..275690a 100644 (file)
@@ -54,6 +54,11 @@ class SpecialMergeHistory extends SpecialPage {
        function execute( $par ) {
                global $wgOut, $wgRequest, $wgUser;
 
+               if ( wfReadOnly() ) {
+                       $wgOut->readOnlyPage();
+                       return;
+               }
+
                if( !$this->userCanExecute( $wgUser ) ) {
                        $this->displayRestrictionError();
                        return;
index 967d211..8c1eee7 100644 (file)
@@ -19,6 +19,11 @@ class SpecialResetpass extends SpecialPage {
        function execute( $par ) {
                global $wgUser, $wgAuth, $wgOut, $wgRequest;
 
+               if ( wfReadOnly() ) {
+                       $wgOut->readOnlyPage();
+                       return;
+               }
+
                $this->mUserName = $wgRequest->getVal( 'wpName' );
                $this->mOldpass = $wgRequest->getVal( 'wpPassword' );
                $this->mNewpass = $wgRequest->getVal( 'wpNewPassword' );