r62339 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62338‎ | r62339 | r62340 >
Date:22:28, 11 February 2010
Author:reedy
Status:ok (Comments)
Tags:
Comment:
Cater for some more errors in ApiBase.php
Modified paths:
  • /trunk/phase3/includes/api/ApiBase.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiBase.php
@@ -970,12 +970,20 @@
971971 * @return array in the format of array( key, param1, param2, ... ) or array( 'code' => ..., 'info' => ... )
972972 */
973973 public function getPossibleErrors() {
974 - $ret = array( array( 'readrequired' ) );
 974+ $ret = array();
975975
976976 if ( $this->mustBePosted() ) {
977 - $ret = array_merge( $ret, array( array ('mustbeposted', $this->getModuleName() ) ) );
 977+ $ret = array_merge( $ret, array( array ( 'mustbeposted', $this->getModuleName() ) ) );
978978 }
979979
 980+ if ( $this->isReadMode() ) {
 981+ $ret = array_merge( $ret, array( array ( 'readrequired' ) ) );
 982+ }
 983+
 984+ if ( $this->isWriteMode() ) {
 985+ $ret = array_merge( $ret, array( array ( 'writerequired' ), array( 'writedisabled' ) ) );
 986+ }
 987+
980988 return $ret;
981989 }
982990

Follow-up revisions

RevisionCommit summaryAuthorDate
r62340Simplification as per Bryan on r62339 commentreedy23:09, 11 February 2010

Comments

#Comment by Bryan (talk | contribs)   22:40, 11 February 2010

For those cases just just []: $ret[] = array ( 'mustbeposted', $this->getModuleName() )

Status & tagging log