Revert r78005, verified that r78009 seems to have fixed the problem.
[lhc/web/wiklou.git] / maintenance / importDump.php
index cbe8153..5f47635 100644 (file)
@@ -38,7 +38,7 @@ class BackupReader {
        var $debug     = false;
        var $uploads   = false;
 
-       function BackupReader() {
+       function __construct() {
                $this->stderr = fopen( "php://stderr", "wt" );
        }
 
@@ -60,13 +60,13 @@ class BackupReader {
                        call_user_func( $this->importCallback, $rev );
                }
        }
-       
+
        function handleUpload( $revision ) {
                if ( $this->uploads ) {
                        $this->uploadCount++;
                        // $this->report();
                        $this->progress( "upload: " . $revision->getFilename() );
-                       
+
                        if ( !$this->dryRun ) {
                                // bluuuh hack
                                // call_user_func( $this->uploadCallback, $revision );
@@ -115,7 +115,6 @@ class BackupReader {
        }
 
        function importFromFile( $filename ) {
-               $t = true;
                if ( preg_match( '/\.gz$/', $filename ) ) {
                        $filename = 'compress.zlib://' . $filename;
                }
@@ -124,10 +123,9 @@ class BackupReader {
                }
                elseif ( preg_match( '/\.7z$/', $filename ) ) {
                        $filename = 'mediawiki.compress.7z://' . $filename;
-                       $t = false;
                }
 
-               $file = fopen( $filename, $t ? 'rt' : 't' ); // our 7zip wrapper uses popen, which seems not to like two-letter modes
+               $file = fopen( $filename, 'rt' );
                return $this->importFromHandle( $file );
        }
 
@@ -151,6 +149,10 @@ class BackupReader {
                $this->logItemCallback = $importer->setLogItemCallback(
                        array( &$this, 'handleLogItem' ) );
 
+               if ( $this->dryRun ) {
+                       $importer->setPageOutCallback( null );
+               }
+
                return $importer->doImport();
        }
 }
@@ -182,12 +184,6 @@ if ( isset( $args[0] ) ) {
        $result = $reader->importFromStdin();
 }
 
-if ( WikiError::isError( $result ) ) {
-       echo $result->getMessage() . "\n";
-} else {
-       echo "Done!\n";
-       echo "You might want to run rebuildrecentchanges.php to regenerate\n";
-       echo "the recentchanges page.\n";
-}
-
-
+echo "Done!\n";
+echo "You might want to run rebuildrecentchanges.php to regenerate\n";
+echo "the recentchanges page.\n";