From fe722d85a5d11880ffe94b48f374f152c3996088 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Thu, 11 Feb 2010 21:51:15 +0000 Subject: [PATCH] Move mustBePosted error into messageMap Switch call to dieUsage to dieUsageMsg --- includes/api/ApiBase.php | 5 +++-- includes/api/ApiMain.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) 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(); -- 2.20.1