Merge "Some API errors didn't include the prefix of the module in parameter related...
authorIAlex <ialex.wiki@gmail.com>
Fri, 17 Aug 2012 16:46:37 +0000 (16:46 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 17 Aug 2012 16:46:37 +0000 (16:46 +0000)
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" );
                }
        }