r62545 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62544‎ | r62545 | r62546 >
Date:20:50, 15 February 2010
Author:catrope
Status:ok
Tags:
Comment:
API performance fixes: avoid unstubbing $wgContLang and $wgUser
Modified paths:
  • /trunk/phase3/api.php (modified) (history)
  • /trunk/phase3/includes/api/ApiBase.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiBase.php
@@ -655,9 +655,12 @@
656656 protected function parseMultiValue( $valueName, $value, $allowMultiple, $allowedValues ) {
657657 if ( trim( $value ) === "" && $allowMultiple )
658658 return array();
659 - $sizeLimit = $this->mMainModule->canApiHighLimits() ? self::LIMIT_SML2 : self::LIMIT_SML1;
660 - $valuesList = explode( '|', $value, $sizeLimit + 1 );
661659
 660+ // This is a bit awkward, but we want to avoid calling canApiHighLimits() because it unstubs $wgUser
 661+ $valuesList = explode( '|', $value, self::LIMIT_SML2 + 1 );
 662+ $sizeLimit = count( $valuesList ) > self::LIMIT_SML1 && $this->mMainModule->canApiHighLimits() ?
 663+ self::LIMIT_SML2 : self::LIMIT_SML1;
 664+
662665 if ( self::truncateArray( $valuesList, $sizeLimit ) ) {
663666 $this->setWarning( "Too many values supplied for parameter '$valueName': the limit is $sizeLimit" );
664667 }
Index: trunk/phase3/api.php
@@ -104,7 +104,7 @@
105105
106106 // Set a dummy $wgTitle, because $wgTitle == null breaks various things
107107 // In a perfect world this wouldn't be necessary
108 -$wgTitle = Title::newFromText( 'API' );
 108+$wgTitle = Title::makeTitle( NS_MAIN, 'API' );
109109
110110 /* Construct an ApiMain with the arguments passed via the URL. What we get back
111111 * is some form of an ApiMain, possibly even one that produces an error message,

Follow-up revisions

RevisionCommit summaryAuthorDate
r62546wmf-deployment: MFT r62545catrope20:53, 15 February 2010

Status & tagging log