* Removed WikiPage::isBigDeletion(). (deprecated since 1.19)
* Removed MWInit class which contained functions related to a now discontinued
PHP compiler called hphpc. (deprecated since 1.22)
+* ApiResult::enableSizeCheck() and disableSizeCheck() are now obsolete.
==== Renamed classes ====
* CLDRPluralRuleConverter_Expression to CLDRPluralRuleConverterExpression
}
$msg = array();
ApiResult::setContent( $msg, $warning );
- $result->disableSizeCheck();
$result->addValue( 'warnings', $moduleName,
- $msg, ApiResult::OVERRIDE | ApiResult::ADD_ON_TOP );
- $result->enableSizeCheck();
+ $msg, ApiResult::OVERRIDE | ApiResult::ADD_ON_TOP | ApiResult::NO_SIZE_CHECK );
}
/**
// Disable size checking for this because we can't continue
// cleanly; size checking would cause more problems than it'd
// solve
- $result->disableSizeCheck();
- $result->addValue( null, '_feed', $feed );
- $result->addValue( null, '_feeditems', $feedItems );
- $result->enableSizeCheck();
+ $result->addValue( null, '_feed', $feed, ApiResult::NO_SIZE_CHECK );
+ $result->addValue( null, '_feeditems', $feedItems, ApiResult::NO_SIZE_CHECK );
}
/**
$warnings = isset( $oldResult['warnings'] ) ? $oldResult['warnings'] : null;
$result->reset();
- $result->disableSizeCheck();
// Re-add the id
$requestid = $this->getParameter( 'requestid' );
if ( !is_null( $requestid ) ) {
- $result->addValue( null, 'requestid', $requestid );
+ $result->addValue( null, 'requestid', $requestid, ApiResult::NO_SIZE_CHECK );
}
if ( $config->get( 'ShowHostnames' ) ) {
// servedby is especially useful when debugging errors
- $result->addValue( null, 'servedby', wfHostName() );
+ $result->addValue( null, 'servedby', wfHostName(), ApiResult::NO_SIZE_CHECK );
}
if ( $warnings !== null ) {
- $result->addValue( null, 'warnings', $warnings );
+ $result->addValue( null, 'warnings', $warnings, ApiResult::NO_SIZE_CHECK );
}
- $result->addValue( null, 'error', $errMessage );
+ $result->addValue( null, 'error', $errMessage, ApiResult::NO_SIZE_CHECK );
return $errMessage['code'];
}
// Don't check the size of exported stuff
// It's not continuable, so it would cause more
// problems than it'd solve
- $result->disableSizeCheck();
if ( $this->mParams['exportnowrap'] ) {
$result->reset();
// Raw formatter will handle this
- $result->addValue( null, 'text', $exportxml );
- $result->addValue( null, 'mime', 'text/xml' );
+ $result->addValue( null, 'text', $exportxml, ApiResult::NO_SIZE_CHECK );
+ $result->addValue( null, 'mime', 'text/xml', ApiResult::NO_SIZE_CHECK );
} else {
$r = array();
ApiResult::setContent( $r, $exportxml );
- $result->addValue( 'query', 'export', $r );
+ $result->addValue( 'query', 'export', $r, ApiResult::NO_SIZE_CHECK );
}
- $result->enableSizeCheck();
}
public function getAllowedParams( $flags = 0 ) {
*/
const ADD_ON_TOP = 2;
+ /**
+ * For addValue() and setElement(), do not check size while adding a value
+ * Don't use this unless you REALLY know what you're doing.
+ * Values added while the size checking was disabled will never be counted
+ * @since 1.24
+ */
+ const NO_SIZE_CHECK = 4;
+
private $mData, $mIsRawMode, $mSize, $mCheckingSize;
private $continueAllModules = array();
* Disable size checking in addValue(). Don't use this unless you
* REALLY know what you're doing. Values added while size checking
* was disabled will not be counted (ever)
+ * @deprecated since 1.24, use ApiResult::NO_SIZE_CHECK
*/
public function disableSizeCheck() {
$this->mCheckingSize = false;
/**
* Re-enable size checking in addValue()
+ * @deprecated since 1.24, use ApiResult::NO_SIZE_CHECK
*/
public function enableSizeCheck() {
$this->mCheckingSize = true;
* @param array|string|null $path
* @param string $name
* @param mixed $value
- * @param int $flags Zero or more OR-ed flags like OVERRIDE | ADD_ON_TOP. This
- * parameter used to be boolean, and the value of OVERRIDE=1 was specifically
- * chosen so that it would be backwards compatible with the new method
- * signature.
+ * @param int $flags Zero or more OR-ed flags like OVERRIDE | ADD_ON_TOP.
+ * This parameter used to be boolean, and the value of OVERRIDE=1 was specifically
+ * chosen so that it would be backwards compatible with the new method signature.
* @return bool True if $value fits in the result, false if not
*
* @since 1.21 int $flags replaced boolean $override
*/
public function addValue( $path, $name, $value, $flags = 0 ) {
$data = &$this->mData;
- if ( $this->mCheckingSize ) {
+ if ( $this->mCheckingSize && !( $flags & ApiResult::NO_SIZE_CHECK ) ) {
$newsize = $this->mSize + self::size( $value );
$maxResultSize = $this->getConfig()->get( 'APIMaxResultSize' );
if ( $newsize > $maxResultSize ) {
}
}
if ( $data ) {
- $this->disableSizeCheck();
- $this->addValue( null, $key, $data, ApiResult::ADD_ON_TOP );
- $this->enableSizeCheck();
+ $this->addValue( null, $key, $data, ApiResult::ADD_ON_TOP | ApiResult::NO_SIZE_CHECK );
}
}
}