+ public function execute() {
+ $this->outputDirectory = $this->getOption( 'output-dir' );
+ $this->prefix = $this->getOption( 'prefix', 'wiki' );
+ $this->startTime = wfTime();
+
+ if ( $this->hasOption( 'parser' ) ) {
+ global $wgParserConf;
+ $wgParserConf['class'] = $this->getOption( 'parser' );
+ $this->prefix .= "-{$wgParserConf['class']}";
+ }
+
+ $source = new ImportStreamSource( $this->getStdin() );
+ $importer = new WikiImporter( $source );
+
+ $importer->setRevisionCallback(
+ array( &$this, 'handleRevision' ) );
+
+ $importer->doImport();
+
+ $delta = wfTime() - $this->startTime;
+ $this->error( "Rendered {$this->count} pages in " . round($delta, 2) . " seconds " );
+ if ($delta > 0)
+ $this->error( round($this->count / $delta, 2) . " pages/sec" );
+ $this->error( "\n" );
+ }
+
+ /**
+ * Callback function for each revision, turn into HTML and save
+ * @param $rev Revision
+ */
+ public function handleRevision( $rev ) {
+ global $wgParserConf;
+