$this->checkOptions();
if ( $this->hasOption( 'file' ) ) {
- $revision = new WikiRevision;
+ $revision = new WikiRevision( $this->getConfig() );
$revision->setText( file_get_contents( $this->getOption( 'file' ) ) );
- $revision->setTitle( Title::newFromText( rawurldecode( basename( $this->getOption( 'file' ), '.txt' ) ) ) );
+ $revision->setTitle( Title::newFromText(
+ rawurldecode( basename( $this->getOption( 'file' ), '.txt' ) )
+ ) );
$this->handleRevision( $revision );
+
return;
}
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 );
+ $importer = new WikiImporter( $source, $this->getConfig() );
$importer->setRevisionCallback(
array( &$this, 'handleRevision' ) );
$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)
+ # 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)
$this->error( "Memory peak usage of " . memory_get_peak_usage() . " bytes\n" );
}
/**
* Callback function for each revision, child classes should override
* processRevision instead.
- * @param $rev Revision
+ * @param DatabaseBase $rev
*/
public function handleRevision( $rev ) {
$title = $rev->getTitle();
if ( !$title ) {
$this->error( "Got bogus revision with null title!" );
+
return;
}
}
/**
- * @param $rev Revision
+ * @param Revision $rev
*/
public function processRevision( $rev ) {
if ( preg_match( $this->getOption( 'regex' ), $rev->getContent()->getTextForSearchIndex() ) ) {