X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FrenderDump.php;h=cc5ae5961ebda2a3f2550681ef20cbbbb4a3a6fa;hb=ae031e237eab8e2023d0fe128f9749a8a43ea439;hp=b76d9a12a4639cb58455be65e4037941e49815f0;hpb=0e675650aed26a742a9c2173d9469647a9f42bcc;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/renderDump.php b/maintenance/renderDump.php index b76d9a12a4..cc5ae5961e 100644 --- a/maintenance/renderDump.php +++ b/maintenance/renderDump.php @@ -43,7 +43,8 @@ class DumpRenderer extends Maintenance { public function __construct() { parent::__construct(); - $this->mDescription = "Take page text out of an XML dump file and render basic HTML out to files"; + $this->addDescription( + 'Take page text out of an XML dump file and render basic HTML out to files' ); $this->addOption( 'output-dir', 'The directory to output the HTML files to', true, true ); $this->addOption( 'prefix', 'Prefix for the rendered files (defaults to wiki)', false, true ); $this->addOption( 'parser', 'Use an alternative parser class', false, true ); @@ -61,10 +62,13 @@ class DumpRenderer extends Maintenance { } $source = new ImportStreamSource( $this->getStdin() ); - $importer = new WikiImporter( $source ); + $importer = new WikiImporter( $source, $this->getConfig() ); $importer->setRevisionCallback( - array( &$this, 'handleRevision' ) ); + [ $this, 'handleRevision' ] ); + $importer->setNoticeCallback( function ( $msg, $params ) { + echo wfMessage( $msg, $params )->text() . "\n"; + } ); $importer->doImport(); @@ -84,6 +88,7 @@ class DumpRenderer extends Maintenance { $title = $rev->getTitle(); if ( !$title ) { $this->error( "Got bogus revision with null title!" ); + return; } $display = $title->getPrefixedText(); @@ -118,5 +123,5 @@ class DumpRenderer extends Maintenance { } } -$maintClass = "DumpRenderer"; +$maintClass = DumpRenderer::class; require_once RUN_MAINTENANCE_IF_MAIN;