Move mustBePosted error into messageMap
authorSam Reed <reedy@users.mediawiki.org>
Thu, 11 Feb 2010 21:51:15 +0000 (21:51 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Thu, 11 Feb 2010 21:51:15 +0000 (21:51 +0000)
Switch call to dieUsage to dieUsageMsg

includes/api/ApiBase.php
includes/api/ApiMain.php

index 224fecf..d42aadd 100644 (file)
@@ -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;
        }
        
index 5cbba76..ad010f1 100644 (file)
@@ -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();