protected $firstPageWritten = false;
protected $lastPageWritten = false;
protected $checkpointJustWritten = false;
- protected $checkpointFiles = array();
+ protected $checkpointFiles = [];
/**
* @var DatabaseBase
function __construct( $args = null ) {
parent::__construct();
- $this->mDescription = <<<TEXT
+ $this->addDescription( <<<TEXT
This script postprocesses XML dumps from dumpBackup.php to add
page text which was stubbed out (using --stub).
XML input is accepted on stdin.
XML output is sent to stdout; progress reports are sent to stderr.
-TEXT;
+TEXT
+ );
$this->stderr = fopen( "php://stderr", "wt" );
$this->addOption( 'stub', 'To load a compressed stub dump instead of stdin. ' .
xml_set_element_handler(
$parser,
- array( &$this, 'startElement' ),
- array( &$this, 'endElement' )
+ [ $this, 'startElement' ],
+ [ $this, 'endElement' ]
);
- xml_set_character_data_handler( $parser, array( &$this, 'characterData' ) );
+ xml_set_character_data_handler( $parser, [ $this, 'characterData' ] );
$offset = 0; // for context extraction on error reporting
do {
$filenameList = (array)$this->egress->getFilenames();
// we wrote some stuff after last checkpoint that needs renamed
if ( file_exists( $filenameList[0] ) ) {
- $newFilenames = array();
+ $newFilenames = [];
# we might have just written the header and footer and had no
# pages or revisions written... perhaps they were all deleted
# there's no pageID 0 so we use that. the caller is responsible
if ( $model === null && $wgContentHandlerUseDB ) {
$row = $this->db->selectRow(
'revision',
- array( 'rev_content_model', 'rev_content_format' ),
- array( 'rev_id' => $this->thisRev ),
+ [ 'rev_content_model', 'rev_content_format' ],
+ [ 'rev_id' => $this->thisRev ],
__METHOD__
);
if ( $model !== CONTENT_MODEL_WIKITEXT ) {
$revLength = strlen( $text );
} else {
- $revLength = $this->db->selectField( 'revision', 'rev_len', array( 'rev_id' => $revID ) );
+ $revLength = $this->db->selectField( 'revision', 'rev_len', [ 'rev_id' => $revID ] );
}
if ( strlen( $text ) == $revLength ) {
throw new MWException( __METHOD__ . "No database available" );
}
$row = $this->db->selectRow( 'text',
- array( 'old_text', 'old_flags' ),
- array( 'old_id' => $id ),
+ [ 'old_text', 'old_flags' ],
+ [ 'old_id' => $id ],
__METHOD__ );
$text = Revision::getRevisionText( $row );
if ( $text === false ) {
if ( file_exists( "$IP/../multiversion/MWScript.php" ) ) {
$cmd = implode( " ",
array_map( 'wfEscapeShellArg',
- array(
+ [
$this->php,
"$IP/../multiversion/MWScript.php",
"fetchText.php",
- '--wiki', wfWikiID() ) ) );
+ '--wiki', wfWikiID() ] ) );
} else {
$cmd = implode( " ",
array_map( 'wfEscapeShellArg',
- array(
+ [
$this->php,
"$IP/maintenance/fetchText.php",
- '--wiki', wfWikiID() ) ) );
+ '--wiki', wfWikiID() ] ) );
}
- $spec = array(
- 0 => array( "pipe", "r" ),
- 1 => array( "pipe", "w" ),
- 2 => array( "file", "/dev/null", "a" ) );
- $pipes = array();
+ $spec = [
+ 0 => [ "pipe", "r" ],
+ 1 => [ "pipe", "w" ],
+ 2 => [ "file", "/dev/null", "a" ] ];
+ $pipes = [];
$this->progress( "Spawning database subprocess: $cmd" );
$this->spawnProc = proc_open( $cmd, $spec, $pipes );
$format = $format === '' ? null : $format;
$text = $this->getText( $id, $model, $format );
- $this->openElement = array( $name, array( 'xml:space' => 'preserve' ) );
+ $this->openElement = [ $name, [ 'xml:space' => 'preserve' ] ];
if ( strlen( $text ) > 0 ) {
$this->characterData( $parser, $text );
}
} else {
- $this->openElement = array( $name, $attribs );
+ $this->openElement = [ $name, $attribs ];
}
}
// this could be more than one file if we had more than one output arg
$filenameList = (array)$this->egress->getFilenames();
- $newFilenames = array();
+ $newFilenames = [];
$firstPageID = str_pad( $this->firstPageWritten, 9, "0", STR_PAD_LEFT );
$lastPageID = str_pad( $this->lastPageWritten, 9, "0", STR_PAD_LEFT );
$filenamesCount = count( $filenameList );