r62546 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62545‎ | r62546 | r62547 >
Date:20:53, 15 February 2010
Author:catrope
Status:ok
Tags:
Comment:
wmf-deployment: MFT r62545
Modified paths:
  • /branches/wmf-deployment/api.php (modified) (history)
  • /branches/wmf-deployment/includes/api/ApiBase.php (modified) (history)

Diff [purge]

Index: branches/wmf-deployment/includes/api/ApiBase.php
@@ -642,10 +642,14 @@
643643 protected function parseMultiValue($valueName, $value, $allowMultiple, $allowedValues) {
644644 if( trim($value) === "" && $allowMultiple)
645645 return array();
646 - $sizeLimit = $this->mMainModule->canApiHighLimits() ? self::LIMIT_SML2 : self::LIMIT_SML1;
647 - $valuesList = explode('|', $value, $sizeLimit + 1);
648 - if( self::truncateArray($valuesList, $sizeLimit) ) {
649 - $this->setWarning("Too many values supplied for parameter '$valueName': the limit is $sizeLimit");
 646+
 647+ // This is a bit awkward, but we want to avoid calling canApiHighLimits() because it unstubs $wgUser
 648+ $valuesList = explode( '|', $value, self::LIMIT_SML2 + 1 );
 649+ $sizeLimit = count( $valuesList ) > self::LIMIT_SML1 && $this->mMainModule->canApiHighLimits() ?
 650+ self::LIMIT_SML2 : self::LIMIT_SML1;
 651+
 652+ if ( self::truncateArray( $valuesList, $sizeLimit ) ) {
 653+ $this->setWarning( "Too many values supplied for parameter '$valueName': the limit is $sizeLimit" );
650654 }
651655 if (!$allowMultiple && count($valuesList) != 1) {
652656 $possibleValues = is_array($allowedValues) ? "of '" . implode("', '", $allowedValues) . "'" : '';
Index: branches/wmf-deployment/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,

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r62545API performance fixes: avoid unstubbing $wgContLang and $wgUsercatrope20:50, 15 February 2010

Status & tagging log