var $pageCount = 0;
var $revCount = 0;
var $dryRun = false;
+ var $debug = false;
function BackupReader() {
$this->stderr = fopen( "php://stderr", "wt" );
call_user_func( $this->importCallback, $rev );
}
}
+
+ function handleUpload( $data ) {
+ $this->uploadCount++;
+ //$this->report();
+ $this->progress( "upload: " . $data->getFilename() );
+
+ if( !$this->dryRun ) {
+ call_user_func( $this->uploadCallback, $data );
+ }
+ }
function report( $final = false ) {
if( $final xor ( $this->pageCount % $this->reportingInterval == 0 ) ) {
$source = new ImportStreamSource( $handle );
$importer = new WikiImporter( $source );
+ $importer->setDebug( $this->debug );
$importer->setPageCallback( array( &$this, 'reportPage' ) );
$this->importCallback = $importer->setRevisionCallback(
array( &$this, 'handleRevision' ) );
+ $this->uploadCallback = $importer->setUploadCallback(
+ array( &$this, 'handleUpload' ) );
return $importer->doImport();
}
if( isset( $options['dry-run'] ) ) {
$reader->dryRun = true;
}
+if( isset( $options['debug'] ) ) {
+ $reader->debug = true;
+}
if( isset( $args[0] ) ) {
$result = $reader->importFromFile( $args[0] );