From: Sam Reed Date: Wed, 4 Aug 2010 20:27:56 +0000 (+0000) Subject: Followup r70460/r70461 X-Git-Tag: 1.31.0-rc.0~35720 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/password.php?a=commitdiff_plain;h=dd889d04c432ef3868250e3358a7c0daa78c13ad;p=lhc%2Fweb%2Fwiklou.git 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 --- 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]; }