* Fixed "link" parameter in image links with "thumb" parameter.
* (bug 23936) Add "displaytitle" to query/info API
* (bug 24485) Make iwbacklinks a generator, optionally display iwprefix and iwtitle
+* (bug 24564) Fix fatal errors when using list=deletedrevs, prop=revisions or
+ one of the backlinks generators with limit=max.
=== Languages updated in 1.17 ===
$min = isset( $paramSettings[self::PARAM_MIN] ) ? $paramSettings[self::PARAM_MIN] : 0;
if ( $value == 'max' ) {
$value = $this->getMain()->canApiHighLimits() ? $paramSettings[self::PARAM_MAX2] : $paramSettings[self::PARAM_MAX];
- $this->getResult()->addValue( 'limits', $this->getModuleName(), $value );
+ $this->getResult()->setParsedLimit( $this->getModuleName(), $value );
} else {
$value = intval( $value );
$this->validateLimit( $paramName, $value, $min, $paramSettings[self::PARAM_MAX], $paramSettings[self::PARAM_MAX2] );
$botMax = ( $this->redirect ? ApiBase::LIMIT_BIG2 / 2 : ApiBase::LIMIT_BIG2 );
if ( $this->params['limit'] == 'max' ) {
$this->params['limit'] = $this->getMain()->canApiHighLimits() ? $botMax : $userMax;
- $this->getResult()->addValue( 'limits', $this->getModuleName(), $this->params['limit'] );
+ $this->getResult()->setParsedLimit( $this->getModuleName(), $this->params['limit'] );
}
$this->processContinue();
if ( $limit == 'max' ) {
$limit = $this->getMain()->canApiHighLimits() ? $botMax : $userMax;
- $this->getResult()->addValue( 'limits', $this->getModuleName(), $limit );
+ $this->getResult()->setParsedLimit( $this->getModuleName(), $limit );
}
$this->validateLimit( 'limit', $limit, 1, $userMax, $botMax );
* @param $arr array to add $value to
* @param $name string Index of $arr to add $value at
* @param $value mixed
+ * @param $overwrite bool Whether overwriting an existing element is allowed
*/
- public static function setElement( &$arr, $name, $value ) {
+ public static function setElement( &$arr, $name, $value, $overwrite = false ) {
if ( $arr === null || $name === null || $value === null || !is_array( $arr ) || is_array( $name ) ) {
ApiBase::dieDebug( __METHOD__, 'Bad parameter' );
}
- if ( !isset ( $arr[$name] ) ) {
+ if ( !isset ( $arr[$name] ) || $overwrite ) {
$arr[$name] = $value;
} elseif ( is_array( $arr[$name] ) && is_array( $value ) ) {
$merged = array_intersect_key( $arr[$name], $value );
* If $name is empty, the $value is added as a next list element data[] = $value
* @return bool True if $value fits in the result, false if not
*/
- public function addValue( $path, $name, $value ) {
+ public function addValue( $path, $name, $value, $overwrite = false ) {
global $wgAPIMaxResultSize;
$data = &$this->mData;
if ( $this->mCheckingSize ) {
if ( !$name ) {
$data[] = $value; // Add list element
} else {
- ApiResult::setElement( $data, $name, $value ); // Add named element
+ self::setElement( $data, $name, $value, $overwrite ); // Add named element
}
return true;
}
+
+ /**
+ * Add a parsed limit=max to the result.
+ *
+ * @param $moduleName string
+ * @param $limit int
+ */
+ public function setParsedLimit( $moduleName, $limit ) {
+ // Add value, allowing overwriting
+ $this->addValue( 'limits', $moduleName, $limit, true );
+ }
/**
* Unset a value previously added to the result set.