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" );
}
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 ) {
$this->thisPage .= $data;
}
}
- elseif ( $this->lastName == "model" ) {
+ elseif ( $this->lastName == "model" ) {
$this->thisRevModel .= $data;
}
- elseif ( $this->lastName == "format" ) {
+ elseif ( $this->lastName == "format" ) {
$this->thisRevFormat .= $data;
}