From c6e2265424df09e7676254ba60af342b31329e2f Mon Sep 17 00:00:00 2001 From: Reedy Date: Fri, 17 Aug 2012 14:52:15 +0100 Subject: [PATCH] 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 --- includes/api/ApiBase.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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" ); } } -- 2.20.1