X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FdumpIterator.php;h=3937751cc6778ee0f078e8d49298be6451d4c106;hb=5183f4481ed3e47d2efe795c84e2dc5d32a09bfa;hp=3657f960f7644345943d5f9f9719486ec3d8128e;hpb=850373ba9c606594cd5b8069664c0eeb5d87562e;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/dumpIterator.php b/maintenance/dumpIterator.php index 3657f960f7..3937751cc6 100644 --- a/maintenance/dumpIterator.php +++ b/maintenance/dumpIterator.php @@ -47,13 +47,13 @@ abstract class DumpIterator extends Maintenance { } public function execute() { - if (! ( $this->hasOption('file') ^ $this->hasOption('dump') ) ) { - $this->error("You must provide a file or dump", true); + if ( !( $this->hasOption( 'file' ) ^ $this->hasOption( 'dump' ) ) ) { + $this->error( "You must provide a file or dump", true ); } $this->checkOptions(); - if ( $this->hasOption('file') ) { + if ( $this->hasOption( 'file' ) ) { $revision = new WikiRevision; $revision->setText( file_get_contents( $this->getOption( 'file' ) ) ); @@ -64,10 +64,10 @@ abstract class DumpIterator extends Maintenance { $this->startTime = microtime( true ); - if ( $this->getOption('dump') == '-' ) { + 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 ); @@ -81,9 +81,10 @@ abstract class DumpIterator extends Maintenance { $this->conclusions(); $delta = microtime( true ) - $this->startTime; - $this->error( "Done {$this->count} revisions in " . round($delta, 2) . " seconds " ); - if ($delta > 0) - $this->error( round($this->count / $delta, 2) . " pages/sec" ); + $this->error( "Done {$this->count} revisions in " . round( $delta, 2 ) . " seconds " ); + if ( $delta > 0 ) { + $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) @@ -96,7 +97,7 @@ abstract class DumpIterator extends Maintenance { if ( $this->getDbType() == Maintenance::DB_NONE ) { global $wgUseDatabaseMessages, $wgLocalisationCacheConf, $wgHooks; $wgUseDatabaseMessages = false; - $wgLocalisationCacheConf['storeClass'] = 'LCStore_Null'; + $wgLocalisationCacheConf['storeClass'] = 'LCStore_Null'; $wgHooks['InterwikiLoadPrefix'][] = 'DumpIterator::disableInterwikis'; } } @@ -122,9 +123,10 @@ abstract class DumpIterator extends Maintenance { $this->count++; if ( isset( $this->from ) ) { - if ( $this->from != $title ) + if ( $this->from != $title ) { return; - $this->output( "Skipped " . ($this->count - 1) . " pages\n" ); + } + $this->output( "Skipped " . ( $this->count - 1 ) . " pages\n" ); $this->count = 1; $this->from = null; @@ -168,7 +170,7 @@ class SearchDump extends DumpIterator { * @param $rev Revision */ public function processRevision( $rev ) { - if ( preg_match( $this->getOption( 'regex' ), $rev->getText() ) ) { + if ( preg_match( $this->getOption( 'regex' ), $rev->getContent()->getTextForSearchIndex() ) ) { $this->output( $rev->getTitle() . " matches at edit from " . $rev->getTimestamp() . "\n" ); } }