X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/bilan.php?a=blobdiff_plain;f=maintenance%2FdumpTextPass.php;h=cfb59c6004301afe70da41867a2e489ebb2f68db;hb=4fd1f42d0b8f61fa970a5e1dbb37a0979a11e537;hp=12ccd0e0ae13b47c0e5a4fd423b338cd1b9b54e5;hpb=f974181ead2444f6196c6156de702e2831863660;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/dumpTextPass.php b/maintenance/dumpTextPass.php index 12ccd0e0ae..cfb59c6004 100644 --- a/maintenance/dumpTextPass.php +++ b/maintenance/dumpTextPass.php @@ -74,13 +74,16 @@ class TextPassDumper extends BackupDumper { */ protected $spawnErr = false; + /** + * @var bool|XmlDumpWriter + */ protected $xmlwriterobj = false; protected $timeExceeded = false; protected $firstPageWritten = false; protected $lastPageWritten = false; protected $checkpointJustWritten = false; - protected $checkpointFiles = array(); + protected $checkpointFiles = []; /** * @var DatabaseBase @@ -426,10 +429,10 @@ TEXT 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 { @@ -458,7 +461,7 @@ TEXT $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 @@ -551,8 +554,8 @@ TEXT 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__ ); @@ -636,7 +639,7 @@ TEXT 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 ) { @@ -704,8 +707,8 @@ TEXT 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 ) { @@ -735,24 +738,24 @@ TEXT 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 ); @@ -880,12 +883,12 @@ TEXT $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 ]; } } @@ -923,7 +926,7 @@ TEXT // 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 );