From: Brion Vibber Date: Fri, 12 May 2006 08:50:14 +0000 (+0000) Subject: * dumpTextPass progress includes percentage of items prefetched X-Git-Tag: 1.31.0-rc.0~57173 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/password.php?a=commitdiff_plain;h=f8e629a6ea3bb27892afe60dcbe3ef87dec861ea;p=lhc%2Fweb%2Fwiklou.git * dumpTextPass progress includes percentage of items prefetched --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 7b26eb9266..bef7e38a81 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -243,6 +243,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN v1.6 now die with a backtrace. They will be removed in v1.8 * dumpTextPass now skips goes to database for entries that were blank in the previous dump, as this may indicate a broken dump. +* dumpTextPass progress includes percentage of items prefetched == Compatibility == diff --git a/maintenance/dumpTextPass.php b/maintenance/dumpTextPass.php index 02eb3d7aac..7d662c4ac4 100644 --- a/maintenance/dumpTextPass.php +++ b/maintenance/dumpTextPass.php @@ -32,6 +32,8 @@ class TextPassDumper extends BackupDumper { var $prefetch = null; var $input = "php://stdin"; var $history = MW_EXPORT_FULL; + var $fetchCount = 0; + var $prefetchCount = 0; function dump() { # This shouldn't happen if on console... ;) @@ -90,6 +92,36 @@ class TextPassDumper extends BackupDumper { } } + /** + * Overridden to include prefetch ratio if enabled. + */ + function showReport() { + if( !$this->prefetch ) { + return parent::showReport(); + } + + if( $this->reporting ) { + $delta = wfTime() - $this->startTime; + $now = wfTimestamp( TS_DB ); + if( $delta ) { + $rate = $this->pageCount / $delta; + $revrate = $this->revCount / $delta; + $portion = $this->revCount / $this->maxCount; + $eta = $this->startTime + $delta / $portion; + $etats = wfTimestamp( TS_DB, intval( $eta ) ); + $fetchrate = 100.0 * $this->prefetchCount / $this->fetchCount; + } else { + $rate = '-'; + $revrate = '-'; + $etats = '-'; + $fetchrate = '-'; + } + global $wgDBname; + $this->progress( sprintf( "%s: %s %d pages (%0.3f/sec), %d revs (%0.3f/sec), %0.1f%% prefetched, ETA %s [max %d]", + $now, $wgDBname, $this->pageCount, $rate, $this->revCount, $revrate, $fetchrate, $etats, $this->maxCount ) ); + } + } + function readDump( $input ) { $this->buffer = ""; $this->openElement = false; @@ -121,6 +153,7 @@ class TextPassDumper extends BackupDumper { } function getText( $id ) { + $this->fetchCount++; if( isset( $this->prefetch ) ) { $text = $this->prefetch->prefetch( $this->thisPage, $this->thisRev ); if( $text === null ) { @@ -129,6 +162,7 @@ class TextPassDumper extends BackupDumper { // Blank entries may indicate that the prior dump was broken. // To be safe, reload it. } else { + $this->prefetchCount++; return $text; } }