From d9022f63880ce039446fba8364f68e656b7bf4cb Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 3 May 2012 13:01:35 +0200 Subject: Update to MediaWiki 1.19.0 --- maintenance/importDump.php | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'maintenance/importDump.php') diff --git a/maintenance/importDump.php b/maintenance/importDump.php index 099b7895..2ad0872f 100644 --- a/maintenance/importDump.php +++ b/maintenance/importDump.php @@ -57,12 +57,13 @@ TEXT; $this->stderr = fopen( "php://stderr", "wt" ); $this->addOption( 'report', 'Report position and speed after every n pages processed', false, true ); - $this->addOption( 'namespaces', + $this->addOption( 'namespaces', 'Import only the pages from namespaces belonging to the list of ' . 'pipe-separated namespace names or namespace indexes', false, true ); $this->addOption( 'dry-run', 'Parse dump without actually importing pages' ); $this->addOption( 'debug', 'Output extra verbose debug information' ); $this->addOption( 'uploads', 'Process file upload data if included (experimental)' ); + $this->addOption( 'no-updates', 'Disable link table updates. Is faster but leaves the wiki in an inconsistent state' ); $this->addOption( 'image-base-path', 'Import files from a specified path', false, true ); $this->addArg( 'file', 'Dump file to import [else use stdin]', false ); } @@ -73,6 +74,10 @@ TEXT; } $this->reportingInterval = intval( $this->getOption( 'report', 100 ) ); + if ( !$this->reportingInterval ) { + $this->reportingInterval = 100; // avoid division by zero + } + $this->dryRun = $this->hasOption( 'dry-run' ); $this->uploads = $this->hasOption( 'uploads' ); // experimental! if ( $this->hasOption( 'image-base-path' ) ) { @@ -112,6 +117,10 @@ TEXT; $this->error( "Unknown namespace text / index specified: $namespace", true ); } + /** + * @param $obj Title|Revision + * @return bool + */ private function skippedNamespace( $obj ) { if ( $obj instanceof Title ) { $ns = $obj->getNamespace(); @@ -130,6 +139,10 @@ TEXT; $this->pageCount++; } + /** + * @param $rev Revision + * @return mixed + */ function handleRevision( $rev ) { $title = $rev->getTitle(); if ( !$title ) { @@ -149,6 +162,10 @@ TEXT; } } + /** + * @param $revision Revision + * @return bool + */ function handleUpload( $revision ) { if ( $this->uploads ) { if ( $this->skippedNamespace( $revision ) ) { @@ -186,7 +203,7 @@ TEXT; } function showReport() { - if ( $this->mQuiet ) { + if ( !$this->mQuiet ) { $delta = wfTime() - $this->startTime; if ( $delta ) { $rate = sprintf( "%.2f", $this->pageCount / $delta ); @@ -204,7 +221,7 @@ TEXT; } wfWaitForSlaves(); // XXX: Don't let deferred jobs array get absurdly large (bug 24375) - wfDoUpdates( 'commit' ); + DeferredUpdates::doUpdates( 'commit' ); } function progress( $string ) { @@ -214,11 +231,9 @@ TEXT; function importFromFile( $filename ) { if ( preg_match( '/\.gz$/', $filename ) ) { $filename = 'compress.zlib://' . $filename; - } - elseif ( preg_match( '/\.bz2$/', $filename ) ) { + } elseif ( preg_match( '/\.bz2$/', $filename ) ) { $filename = 'compress.bzip2://' . $filename; - } - elseif ( preg_match( '/\.7z$/', $filename ) ) { + } elseif ( preg_match( '/\.7z$/', $filename ) ) { $filename = 'mediawiki.compress.7z://' . $filename; } @@ -243,6 +258,9 @@ TEXT; if( $this->hasOption( 'debug' ) ) { $importer->setDebug( true ); } + if ( $this->hasOption( 'no-updates' ) ) { + $importer->setNoUpdates( true ); + } $importer->setPageCallback( array( &$this, 'reportPage' ) ); $this->importCallback = $importer->setRevisionCallback( array( &$this, 'handleRevision' ) ); -- cgit v1.2.2