From 9fcfa365693a87599f4a0b7604cdfdec328d35ac Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 7 Mar 2008 23:14:30 +0000 Subject: [PATCH] experimental --uploads option on importDump --- maintenance/importDump.php | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/maintenance/importDump.php b/maintenance/importDump.php index 2071a31d31..c1071f660e 100644 --- a/maintenance/importDump.php +++ b/maintenance/importDump.php @@ -32,6 +32,7 @@ class BackupReader { var $revCount = 0; var $dryRun = false; var $debug = false; + var $uploads = false; function BackupReader() { $this->stderr = fopen( "php://stderr", "wt" ); @@ -59,13 +60,18 @@ class BackupReader { } } - function handleUpload( $data ) { - $this->uploadCount++; - //$this->report(); - $this->progress( "upload: " . $data->getFilename() ); - - if( !$this->dryRun ) { - call_user_func( $this->uploadCallback, $data ); + 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 ); + $dbw = wfGetDB( DB_MASTER ); + return $dbw->deadlockLoop( array( $revision, 'importUpload' ) ); + } } } @@ -140,6 +146,9 @@ if( isset( $options['dry-run'] ) ) { if( isset( $options['debug'] ) ) { $reader->debug = true; } +if( isset( $options['uploads'] ) ) { + $reader->uploads = true; // experimental! +} if( isset( $args[0] ) ) { $result = $reader->importFromFile( $args[0] ); -- 2.20.1