From: Reedy Date: Fri, 17 Aug 2012 13:52:15 +0000 (+0100) Subject: Some API errors didn't include the prefix of the module in parameter related error... X-Git-Tag: 1.31.0-rc.0~22706^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/password.php?a=commitdiff_plain;h=c6e2265424df09e7676254ba60af342b31329e2f;p=lhc%2Fweb%2Fwiklou.git Some API errors didn't include the prefix of the module in parameter related error messages This fixes up/normalises these usages (probably want refactoring out at a later date) Change-Id: I5583d69d9e65a1ee09d31a37c88f369e7c0f7708 --- diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index ca9f73869c..1e627663ee 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -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" ); } }