protected $maxConsecutiveFailedTextRetrievals = 200;
protected $failureTimeout = 5; // Seconds to sleep after db failure
+ protected $bufferSize = 524288; // In bytes. Maximum size to read from the stub in on go.
+
protected $php = "php";
protected $spawn = false;
$url = $this->processFileOpt( $val, $param );
switch ( $opt ) {
+ case 'buffersize':
+ // Lower bound for xml reading buffer size is 4 KB
+ $this->bufferSize = max( intval( $val ), 4 * 1024 );
+ break;
case 'prefetch':
require_once "$IP/maintenance/backupPrefetch.inc";
$this->prefetch = new BaseDump( $url );
xml_set_character_data_handler( $parser, array( &$this, 'characterData' ) );
$offset = 0; // for context extraction on error reporting
- $bufferSize = 512 * 1024;
do {
if ( $this->checkIfTimeExceeded() ) {
$this->setTimeExceeded();
}
- $chunk = fread( $input, $bufferSize );
+ $chunk = fread( $input, $this->bufferSize );
if ( !xml_parse( $parser, $chunk, feof( $input ) ) ) {
wfDebug( "TextDumpPass::readDump encountered XML parsing error\n" );
* is thrown.
*
* @param string $id The revision id to get the text for
- * @param string|bool|null $model The content model used to determine applicable export transformations.
- * If $model is null, it will be determined from the database.
+ * @param string|bool|null $model The content model used to determine
+ * applicable export transformations.
+ * If $model is null, it will be determined from the database.
* @param string|null $format The content format used when applying export transformations.
*
* @throws MWException
}
private function getTextSpawned( $id ) {
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
if ( !$this->spawnProc ) {
// First time?
$this->openSpawn();
}
$text = $this->getTextSpawnedOnce( $id );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
return $text;
}
}
private function closeSpawn() {
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
if ( $this->spawnRead ) {
fclose( $this->spawnRead );
}
pclose( $this->spawnProc );
}
$this->spawnProc = false;
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
}
private function getTextSpawnedOnce( $id ) {