r70062 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70061‎ | r70062 | r70063 >
Date:04:12, 28 July 2010
Author:tstarling
Status:ok
Tags:
Comment:
Reintroduced the extractRequestParams() memoization as in r69782, but respecting $parseLimit. Fixes bug 24564 (fatal error due to duplicate calls to addValue()).
Modified paths:
  • /trunk/phase3/includes/api/ApiBase.php (modified) (history)

Diff [purge]

Index: trunk/phase3/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
@@ -479,16 +480,20 @@
480481 * @return array
481482 */
482483 public function extractRequestParams( $parseLimit = true ) {
483 - $params = $this->getFinalParams();
484 - $results = array();
 484+ // Cache parameters, for performance and to avoid bug 24564.
 485+ if ( !isset( $this->mParamCache[$parseLimit] ) ) {
 486+ $params = $this->getFinalParams();
 487+ $results = array();
485488
486 - if ( $params ) { // getFinalParams() can return false
487 - foreach ( $params as $paramName => $paramSettings ) {
488 - $results[$paramName] = $this->getParameterFromSettings( $paramName, $paramSettings, $parseLimit );
 489+ if ( $params ) { // getFinalParams() can return false
 490+ foreach ( $params as $paramName => $paramSettings ) {
 491+ $results[$paramName] = $this->getParameterFromSettings(
 492+ $paramName, $paramSettings, $parseLimit );
 493+ }
489494 }
 495+ $this->mParamCache[$parseLimit] = $results;
490496 }
491 -
492 - return $results;
 497+ return $this->mParamCache[$parseLimit];
493498 }
494499
495500 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r70063MFT r70062: fix fatal error when limit=maxtstarling04:19, 28 July 2010
r70066* MFT r70062: fix for bug 24564 (fatal error with limit=max)...tstarling05:52, 28 July 2010
r70078(bug 24564) Fix fatal errors when using list=deletedrevs, prop=revisions or o...btongminh11:30, 28 July 2010
r70818MFT r70078 to REL1_15...reedy14:21, 10 August 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r69782Followup to r69776: cache result of extractRequestParams() because it gets ca...catrope10:15, 23 July 2010

Status & tagging log