X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FdumpIterator.php;h=d8bc3a4da725d0c78f63b0e86a92c5e0d4e251a6;hb=c3a5d76d1936edf68b8230b755244876ca815e13;hp=c6b39587be2b9c64b25731ad47be6e838ba466df;hpb=d0afaa88434ebcb442c6dda5c46080bbc8e86a53;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/dumpIterator.php b/maintenance/dumpIterator.php index c6b39587be..d8bc3a4da7 100644 --- a/maintenance/dumpIterator.php +++ b/maintenance/dumpIterator.php @@ -54,11 +54,14 @@ abstract class DumpIterator extends Maintenance { $this->checkOptions(); if ( $this->hasOption( 'file' ) ) { - $revision = new WikiRevision; + $revision = new WikiRevision( $this->getConfig() ); $revision->setText( file_get_contents( $this->getOption( 'file' ) ) ); - $revision->setTitle( Title::newFromText( rawurldecode( basename( $this->getOption( 'file' ), '.txt' ) ) ) ); + $revision->setTitle( Title::newFromText( + rawurldecode( basename( $this->getOption( 'file' ), '.txt' ) ) + ) ); $this->handleRevision( $revision ); + return; } @@ -67,9 +70,10 @@ abstract class DumpIterator extends Maintenance { if ( $this->getOption( 'dump' ) == '-' ) { $source = new ImportStreamSource( $this->getStdin() ); } else { - $this->error( "Sorry, I don't support dump filenames yet. Use - and provide it on stdin on the meantime.", true ); + $this->error( "Sorry, I don't support dump filenames yet. " + . "Use - and provide it on stdin on the meantime.", true ); } - $importer = new WikiImporter( $source ); + $importer = new WikiImporter( $source, $this->getConfig() ); $importer->setRevisionCallback( array( &$this, 'handleRevision' ) ); @@ -86,8 +90,9 @@ abstract class DumpIterator extends Maintenance { $this->error( round( $this->count / $delta, 2 ) . " pages/sec" ); } - # Perform the memory_get_peak_usage() when all the other data has been output so there's no damage if it dies. - # It is only available since 5.2.0 (since 5.2.1 if you haven't compiled with --enable-memory-limit) + # Perform the memory_get_peak_usage() when all the other data has been + # output so there's no damage if it dies. It is only available since + # 5.2.0 (since 5.2.1 if you haven't compiled with --enable-memory-limit) $this->error( "Memory peak usage of " . memory_get_peak_usage() . " bytes\n" ); } @@ -112,12 +117,13 @@ abstract class DumpIterator extends Maintenance { /** * Callback function for each revision, child classes should override * processRevision instead. - * @param $rev Revision + * @param DatabaseBase $rev */ public function handleRevision( $rev ) { $title = $rev->getTitle(); if ( !$title ) { $this->error( "Got bogus revision with null title!" ); + return; } @@ -167,7 +173,7 @@ class SearchDump extends DumpIterator { } /** - * @param $rev Revision + * @param Revision $rev */ public function processRevision( $rev ) { if ( preg_match( $this->getOption( 'regex' ), $rev->getContent()->getTextForSearchIndex() ) ) {