wfReadOnly now checked in ApiMain::requestWriteMode
authorBryan Tong Minh <btongminh@users.mediawiki.org>
Thu, 28 Aug 2008 20:25:53 +0000 (20:25 +0000)
committerBryan Tong Minh <btongminh@users.mediawiki.org>
Thu, 28 Aug 2008 20:25:53 +0000 (20:25 +0000)
includes/api/ApiBlock.php
includes/api/ApiDelete.php
includes/api/ApiMain.php
includes/api/ApiUnblock.php
includes/api/ApiUndelete.php

index 2a13c29..3482148 100644 (file)
@@ -72,8 +72,6 @@ class ApiBlock extends ApiBase {
                        $this->dieUsageMsg(array('canthide'));
                if($params['noemail'] && !$wgUser->isAllowed('blockemail'))
                        $this->dieUsageMsg(array('cantblock-email'));
-               if(wfReadOnly())
-                       $this->dieUsageMsg(array('readonlytext'));
 
                $form = new IPBlockForm('');
                $form->BlockAddress = $params['user'];
index 5f1dd47..76d66fe 100644 (file)
@@ -90,8 +90,6 @@ class ApiDelete extends ApiBase {
 
        private static function getPermissionsError(&$title, $token) {
                global $wgUser;
-               // Check wiki readonly
-               if (wfReadOnly()) return array(array('readonlytext'));
                
                // Check permissions
                $errors = $title->getUserPermissionsErrors('delete', $wgUser);
index c3946e5..4751296 100644 (file)
@@ -211,6 +211,8 @@ class ApiMain extends ApiBase {
                if (!$wgUser->isAllowed('writeapi'))
                        $this->dieUsage('You\'re not allowed to edit this ' .
                        'wiki through the API', 'writeapidenied');
+               if (wfReadOnly())
+                       $this->dieUsageMsg(array('readonlytext'));
        }
 
        /**
index cf98f0f..acfeb9a 100644 (file)
@@ -64,8 +64,6 @@ class ApiUnblock extends ApiBase {
                        $this->dieUsageMsg(array('sessionfailure'));
                if(!$wgUser->isAllowed('block'))
                        $this->dieUsageMsg(array('cantunblock'));
-               if(wfReadOnly())
-                       $this->dieUsageMsg(array('readonlytext'));
 
                $id = $params['id'];
                $user = $params['user'];
index 412e283..f54511b 100644 (file)
@@ -51,8 +51,6 @@ class ApiUndelete extends ApiBase {
                        $this->dieUsageMsg(array('permdenied-undelete'));
                if($wgUser->isBlocked())
                        $this->dieUsageMsg(array('blockedtext'));
-               if(wfReadOnly())
-                       $this->dieUsageMsg(array('readonlytext'));
                if(!$wgUser->matchEditToken($params['token']))
                        $this->dieUsageMsg(array('sessionfailure'));