r70477 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70476‎ | r70477 | r70478 >
Date:20:27, 4 August 2010
Author:reedy
Status:ok
Tags:
Comment:
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
Modified paths:
  • /trunk/phase3/includes/api/ApiBase.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiBase.php
@@ -496,18 +496,14 @@
497497 foreach ( $params as $paramName => $paramSettings ) {
498498 $results[$paramName] = $this->getParameterFromSettings(
499499 $paramName, $paramSettings, $parseLimit );
 500+
 501+ if( isset( $paramSettings[self::PARAM_REQUIRED] ) && !isset( $results[$paramName] ) ) {
 502+ $this->dieUsageMsg( array( 'missingparam', $paramName ) );
 503+ }
500504 }
501505 }
502506 $this->mParamCache[$parseLimit] = $results;
503507 }
504 -
505 - $allparams = $this->getAllowedParams();
506 - foreach( $this->mParamCache[$parseLimit] as $param => $val ) {
507 - if( isset( $allparams[$param][ApiBase::PARAM_REQUIRED] ) && !isset( $val ) ) {
508 - $this->dieUsageMsg( array( 'missingparam', $param ) );
509 - }
510 - }
511 -
512508 return $this->mParamCache[$parseLimit];
513509 }
514510

Follow-up revisions

RevisionCommit summaryAuthorDate
r70479Further followup to r70460/r70461 and r70477...reedy21:19, 4 August 2010
r734691.16wmf4: Merging PARAM_REQUIRED support from trunk for upcoming ArticleAsses...catrope18:53, 21 September 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r70460* PARAM_REQUIRED parameter flag added. If this flag is set, and the end user ...soxred9313:35, 4 August 2010
r70461Followup to r70460: Committed wrong version of ApiBase.php, convert all core ...soxred9314:15, 4 August 2010

Status & tagging log