Index: branches/wmf-deployment/includes/api/ApiBase.php |
— | — | @@ -642,10 +642,14 @@ |
643 | 643 | protected function parseMultiValue($valueName, $value, $allowMultiple, $allowedValues) { |
644 | 644 | if( trim($value) === "" && $allowMultiple) |
645 | 645 | 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" ); |
650 | 654 | } |
651 | 655 | if (!$allowMultiple && count($valuesList) != 1) { |
652 | 656 | $possibleValues = is_array($allowedValues) ? "of '" . implode("', '", $allowedValues) . "'" : ''; |
Index: branches/wmf-deployment/api.php |
— | — | @@ -104,7 +104,7 @@ |
105 | 105 | |
106 | 106 | // Set a dummy $wgTitle, because $wgTitle == null breaks various things |
107 | 107 | // In a perfect world this wouldn't be necessary |
108 | | -$wgTitle = Title::newFromText('API'); |
| 108 | +$wgTitle = Title::makeTitle( NS_MAIN, 'API' ); |
109 | 109 | |
110 | 110 | /* Construct an ApiMain with the arguments passed via the URL. What we get back |
111 | 111 | * is some form of an ApiMain, possibly even one that produces an error message, |