X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=maintenance%2FdumpIterator.php;h=e9a6bc58bfc449ac82087728d9e7d319b0fbaf0a;hp=9f983c1a04a5f88299ab62ea7f3bdedbd833c7fc;hb=74426f3cf796b149f1ae445e41815bbe148640b2;hpb=4cb9c1a24bde6e29c5e8f05c7cd1de54ffdd342a diff --git a/maintenance/dumpIterator.php b/maintenance/dumpIterator.php index 9f983c1a04..e9a6bc58bf 100644 --- a/maintenance/dumpIterator.php +++ b/maintenance/dumpIterator.php @@ -48,7 +48,7 @@ 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 ); + $this->fatalError( "You must provide a file or dump" ); } $this->checkOptions(); @@ -70,13 +70,16 @@ 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->fatalError( "Sorry, I don't support dump filenames yet. " + . "Use - and provide it on stdin on the meantime." ); } $importer = new WikiImporter( $source, $this->getConfig() ); $importer->setRevisionCallback( [ $this, 'handleRevision' ] ); + $importer->setNoticeCallback( function ( $msg, $params ) { + echo wfMessage( $msg, $params )->text() . "\n"; + } ); $this->from = $this->getOption( 'from', null ); $this->count = 0; @@ -102,7 +105,7 @@ abstract class DumpIterator extends Maintenance { if ( $this->getDbType() == Maintenance::DB_NONE ) { global $wgUseDatabaseMessages, $wgLocalisationCacheConf, $wgHooks; $wgUseDatabaseMessages = false; - $wgLocalisationCacheConf['storeClass'] = 'LCStoreNull'; + $wgLocalisationCacheConf['storeClass'] = LCStoreNull::class; $wgHooks['InterwikiLoadPrefix'][] = 'DumpIterator::disableInterwikis'; } } @@ -117,7 +120,7 @@ abstract class DumpIterator extends Maintenance { /** * Callback function for each revision, child classes should override * processRevision instead. - * @param Database $rev + * @param WikiRevision $rev */ public function handleRevision( $rev ) { $title = $rev->getTitle(); @@ -182,5 +185,5 @@ class SearchDump extends DumpIterator { } } -$maintClass = "SearchDump"; +$maintClass = SearchDump::class; require_once RUN_MAINTENANCE_IF_MAIN;