X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FrenderDump.php;h=cc5ae5961ebda2a3f2550681ef20cbbbb4a3a6fa;hb=4b9317c97a9a09ef3fe58e2013d83aeb47daf064;hp=eab5fe7569671a121aba7d4ca84070e292eb748b;hpb=a8304d4c73fd04c338ae23f3028fc475921cc0fa;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/renderDump.php b/maintenance/renderDump.php index eab5fe7569..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(); @@ -78,12 +82,13 @@ class DumpRenderer extends Maintenance { /** * Callback function for each revision, turn into HTML and save - * @param $rev Revision + * @param Revision $rev */ public function handleRevision( $rev ) { $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;