From c1af4821bf104055f7c8056a91b4e6305688468e Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Thu, 11 Feb 2010 22:28:30 +0000 Subject: [PATCH] Cater for some more errors in ApiBase.php --- includes/api/ApiBase.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 434f805a16..cd30412c72 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -970,10 +970,18 @@ abstract class ApiBase { * @return array in the format of array( key, param1, param2, ... ) or array( 'code' => ..., 'info' => ... ) */ public function getPossibleErrors() { - $ret = array( array( 'readrequired' ) ); + $ret = array(); if ( $this->mustBePosted() ) { - $ret = array_merge( $ret, array( array ('mustbeposted', $this->getModuleName() ) ) ); + $ret = array_merge( $ret, array( array ( 'mustbeposted', $this->getModuleName() ) ) ); + } + + if ( $this->isReadMode() ) { + $ret = array_merge( $ret, array( array ( 'readrequired' ) ) ); + } + + if ( $this->isWriteMode() ) { + $ret = array_merge( $ret, array( array ( 'writerequired' ), array( 'writedisabled' ) ) ); } return $ret; -- 2.20.1