From dd889d04c432ef3868250e3358a7c0daa78c13ad Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Wed, 4 Aug 2010 20:27:56 +0000 Subject: [PATCH] Followup r70460/r70461 use self consistently Fold in duplicate loop missingparam can be done during attempt to set ParamCache, we might aswell give up and not finish populating the param cache if we're gonna die from a missing param --- includes/api/ApiBase.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 15a3a897fa..be1be86768 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -496,18 +496,14 @@ abstract class ApiBase { foreach ( $params as $paramName => $paramSettings ) { $results[$paramName] = $this->getParameterFromSettings( $paramName, $paramSettings, $parseLimit ); + + if( isset( $paramSettings[self::PARAM_REQUIRED] ) && !isset( $results[$paramName] ) ) { + $this->dieUsageMsg( array( 'missingparam', $paramName ) ); + } } } $this->mParamCache[$parseLimit] = $results; } - - $allparams = $this->getAllowedParams(); - foreach( $this->mParamCache[$parseLimit] as $param => $val ) { - if( isset( $allparams[$param][ApiBase::PARAM_REQUIRED] ) && !isset( $val ) ) { - $this->dieUsageMsg( array( 'missingparam', $param ) ); - } - } - return $this->mParamCache[$parseLimit]; } -- 2.20.1