r70063 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70062‎ | r70063 | r70064 >
Date:04:19, 28 July 2010
Author:tstarling
Status:ok
Tags:
Comment:
MFT r70062: fix fatal error when limit=max
Modified paths:
  • /branches/wmf/1.16wmf4/includes/api/ApiBase.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.16wmf4/includes/api/ApiBase.php
@@ -57,6 +57,7 @@
5858 const LIMIT_SML2 = 500; // Slow query, bot/sysop limit
5959
6060 private $mMainModule, $mModuleName, $mModulePrefix;
 61+ private $mParamCache = array();
6162
6263 /**
6364 * Constructor
@@ -472,16 +473,20 @@
473474 * @return array
474475 */
475476 public function extractRequestParams( $parseLimit = true ) {
476 - $params = $this->getFinalParams();
477 - $results = array();
 477+ // Cache parameters, for performance and to avoid bug 24564.
 478+ if ( !isset( $this->mParamCache[$parseLimit] ) ) {
 479+ $params = $this->getFinalParams();
 480+ $results = array();
478481
479 - if($params) { /* getFinalParams() can return false */
480 - foreach ( $params as $paramName => $paramSettings ) {
481 - $results[$paramName] = $this->getParameterFromSettings( $paramName, $paramSettings, $parseLimit );
 482+ if($params) { /* getFinalParams() can return false */
 483+ foreach ( $params as $paramName => $paramSettings ) {
 484+ $results[$paramName] = $this->getParameterFromSettings(
 485+ $paramName, $paramSettings, $parseLimit );
 486+ }
482487 }
 488+ $this->mParamCache[$parseLimit] = $results;
483489 }
484 -
485 - return $results;
 490+ return $this->mParamCache[$parseLimit];
486491 }
487492
488493 /**
Property changes on: branches/wmf/1.16wmf4/includes/api/ApiBase.php
___________________________________________________________________
Added: svn:mergeinfo
489494 Merged /branches/wmf-deployment/includes/api/ApiBase.php:r53381,59952,60970
490495 Merged /branches/REL1_15/phase3/includes/api/ApiBase.php:r51646
491496 Merged /branches/sqlite/includes/api/ApiBase.php:r58211-58321
492497 Merged /trunk/phase3/includes/api/ApiBase.php:r63549,63764,63897-63901,64454,66486,70062

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r70062Reintroduced the extractRequestParams() memoization as in r69782, but respect...tstarling04:12, 28 July 2010

Status & tagging log