Some API errors didn't include the prefix of the module in parameter related error...
authorReedy <reedy@wikimedia.org>
Fri, 17 Aug 2012 13:52:15 +0000 (14:52 +0100)
committerReedy <reedy@wikimedia.org>
Fri, 17 Aug 2012 13:54:24 +0000 (14:54 +0100)
This fixes up/normalises these usages (probably want refactoring out at a later date)

Change-Id: I5583d69d9e65a1ee09d31a37c88f369e7c0f7708

includes/api/ApiBase.php

index ca9f738..1e62766 100644 (file)
@@ -697,14 +697,15 @@ abstract class ApiBase extends ContextSource {
        public function requireOnlyOneParameter( $params ) {
                $required = func_get_args();
                array_shift( $required );
+               $p = $this->getModulePrefix();
 
                $intersection = array_intersect( array_keys( array_filter( $params,
                        array( $this, "parameterNotEmpty" ) ) ), $required );
 
                if ( count( $intersection ) > 1 ) {
-                       $this->dieUsage( 'The parameters ' . implode( ', ', $intersection ) . ' can not be used together', 'invalidparammix' );
+                       $this->dieUsage( "The parameters {$p}" . implode( ", {$p}",  $intersection ) . ' can not be used together', "{$p}invalidparammix" );
                } elseif ( count( $intersection ) == 0 ) {
-                       $this->dieUsage( 'One of the parameters ' . implode( ', ', $required ) . ' is required', 'missingparam' );
+                       $this->dieUsage( "One of the parameters {$p}" . implode( ", {$p}", $required ) . ' is required', "{$p}missingparam" );
                }
        }
 
@@ -732,12 +733,13 @@ abstract class ApiBase extends ContextSource {
        public function requireMaxOneParameter( $params ) {
                $required = func_get_args();
                array_shift( $required );
+               $p = $this->getModulePrefix();
 
                $intersection = array_intersect( array_keys( array_filter( $params,
                        array( $this, "parameterNotEmpty" ) ) ), $required );
 
                if ( count( $intersection ) > 1 ) {
-                       $this->dieUsage( 'The parameters ' . implode( ', ', $intersection ) . ' can not be used together', 'invalidparammix' );
+                       $this->dieUsage( "The parameters {$p}" . implode( ", {$p}", $intersection ) . ' can not be used together', "{$p}invalidparammix" );
                }
        }