r32939 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r32938‎ | r32939 | r32940 >
Date:06:30, 8 April 2008
Author:tstarling
Status:old
Tags:
Comment:
Fixed progress output
Modified paths:
  • /trunk/phase3/maintenance/archives/upgradeLogging.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/archives/upgradeLogging.php
@@ -101,14 +101,20 @@
102102 function sync( $srcTable, $dstTable ) {
103103 $batchSize = 1000;
104104 $minTs = $this->dbw->selectField( $srcTable, 'MIN(log_timestamp)', false, __METHOD__ );
 105+ $minTsUnix = wfTimestamp( TS_UNIX, $minTs );
105106 $numRowsCopied = 0;
106107
107108 while ( true ) {
108109 $maxTs = $this->dbw->selectField( $srcTable, 'MAX(log_timestamp)', false, __METHOD__ );
109110 $copyPos = $this->dbw->selectField( $dstTable, 'MAX(log_timestamp)', false, __METHOD__ );
 111+ $maxTsUnix = wfTimestamp( TS_UNIX, $maxTs );
 112+ $copyPosUnix = wfTimestamp( TS_UNIX, $copyPos );
110113
111 - $percent = ( wfTimestamp( TS_UNIX, $maxTs ) - wfTimestamp( TS_UNIX, $minTs ) )
112 - / wfTimestamp( TS_UNIX, $copyPos ) * 100;
 114+ if ( $copyPos === null ) {
 115+ $percent = 0;
 116+ } else {
 117+ $percent = ( $copyPosUnix - $minTsUnix ) / ( $maxTsUnix - $minTsUnix ) * 100;
 118+ }
113119 printf( "%s %.2f%%\n", $copyPos, $percent );
114120
115121 # Handle all entries with timestamp equal to $copyPos

Status & tagging log