X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=blobdiff_plain;f=maintenance%2FimportDump.php;h=2071a31d3163856444014a21208c02bdffab13aa;hb=c03460e59385138ee80f4ba8365ec5f82d914c70;hp=211d0a9e38790f2772984e0dfe53c27d56bdb1d8;hpb=1e2782b5e71848e2386bf013a30265d3fddc4afe;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/importDump.php b/maintenance/importDump.php index 211d0a9e38..2071a31d31 100644 --- a/maintenance/importDump.php +++ b/maintenance/importDump.php @@ -31,6 +31,7 @@ class BackupReader { var $pageCount = 0; var $revCount = 0; var $dryRun = false; + var $debug = false; function BackupReader() { $this->stderr = fopen( "php://stderr", "wt" ); @@ -57,6 +58,16 @@ class BackupReader { 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 ) ) { @@ -101,9 +112,12 @@ class BackupReader { $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(); } @@ -123,6 +137,9 @@ if( isset( $options['report'] ) ) { if( isset( $options['dry-run'] ) ) { $reader->dryRun = true; } +if( isset( $options['debug'] ) ) { + $reader->debug = true; +} if( isset( $args[0] ) ) { $result = $reader->importFromFile( $args[0] );