From: Sam Reed Date: Thu, 11 Feb 2010 21:51:15 +0000 (+0000) Subject: Move mustBePosted error into messageMap X-Git-Tag: 1.31.0-rc.0~37813 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dcompta/operations/modifier.php?a=commitdiff_plain;h=fe722d85a5d11880ffe94b48f374f152c3996088;p=lhc%2Fweb%2Fwiklou.git Move mustBePosted error into messageMap Switch call to dieUsage to dieUsageMsg --- diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 224fecf880..d42aaddbcb 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -864,6 +864,7 @@ abstract class ApiBase { 'import-unknownerror' => array( 'code' => 'import-unknownerror', 'info' => "Unknown error on import: ``\$1''" ), 'cantoverwrite-sharedfile' => array( 'code' => 'cantoverwrite-sharedfile', 'info' => 'The target file exists on a shared repository and you do not have permission to override it' ), 'sharedfile-exists' => array( 'code' => 'fileexists-sharedrepo-perm', 'info' => 'The target file exists on a shared repository. Use the ignorewarnings parameter to override it.' ), + 'mustbeposted' => array( 'code' => 'mustbeposted', 'info' => "The \$1 module requires a POST request" ), // ApiEditPage messages 'noimageredirect-anon' => array( 'code' => 'noimageredirect-anon', 'info' => "Anonymous users can't create image redirects" ), @@ -971,9 +972,9 @@ abstract class ApiBase { $ret = array( array( 'readrequired' ) ); if ( $this->mustBePosted() ) { - $ret = array_merge( $ret, array( array( 'code' => 'mustbeposted', 'info' => 'The {$this->mAction} module requires a POST request' ) ) ); + $ret = array_merge( $ret, array( array ('mustbeposted', $this->mModuleName ) ) ); } - + return $ret; } diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index 5cbba764ff..ad010f14f6 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -415,7 +415,7 @@ class ApiMain extends ApiBase { if ( !$this->mInternalMode ) { // Ignore mustBePosted() for internal calls if ( $module->mustBePosted() && !$this->mRequest->wasPosted() ) - $this->dieUsage( "The {$this->mAction} module requires a POST request", 'mustbeposted' ); + $this->dieUsageMsg( array ('mustbeposted', $this->mAction ) ); // See if custom printer is used $this->mPrinter = $module->getCustomPrinter();