function handleRevision( $rev ) {
$title = $rev->getTitle();
if (!$title) {
+ $this->progress( "Got bogus revision with null title!" );
return;
}
$display = $title->getPrefixedText();
$filename = 'compress.zlib://' . $filename;
}
$file = fopen( $filename, 'rt' );
- $this->importFromHandle( $file );
+ return $this->importFromHandle( $file );
}
function importFromStdin() {
$file = fopen( 'php://stdin', 'rt' );
- $this->importFromHandle( $file );
+ return $this->importFromHandle( $file );
}
function importFromHandle( $handle ) {
$this->importCallback = $importer->setRevisionCallback(
array( &$this, 'handleRevision' ) );
- $importer->doImport();
+ return $importer->doImport();
}
}
+if( wfReadOnly() ) {
+ wfDie( "Wiki is in read-only mode; you'll need to disable it for import to work.\n" );
+}
+
$reader = new BackupReader();
if( isset( $options['quiet'] ) ) {
$reader->reporting = false;
}
if( isset( $args[0] ) ) {
- $reader->importFromFile( $args[0] );
+ $result = $reader->importFromFile( $args[0] );
+} else {
+ $result = $reader->importFromStdin();
+}
+
+if( WikiError::isError( $result ) ) {
+ echo $result->getMessage() . "\n";
} else {
- $reader->importFromStdin();
+ echo "Done!\n";
}
?>