Index: trunk/phase3/maintenance/archives/upgradeLogging.php |
— | — | @@ -101,14 +101,20 @@ |
102 | 102 | function sync( $srcTable, $dstTable ) { |
103 | 103 | $batchSize = 1000; |
104 | 104 | $minTs = $this->dbw->selectField( $srcTable, 'MIN(log_timestamp)', false, __METHOD__ ); |
| 105 | + $minTsUnix = wfTimestamp( TS_UNIX, $minTs ); |
105 | 106 | $numRowsCopied = 0; |
106 | 107 | |
107 | 108 | while ( true ) { |
108 | 109 | $maxTs = $this->dbw->selectField( $srcTable, 'MAX(log_timestamp)', false, __METHOD__ ); |
109 | 110 | $copyPos = $this->dbw->selectField( $dstTable, 'MAX(log_timestamp)', false, __METHOD__ ); |
| 111 | + $maxTsUnix = wfTimestamp( TS_UNIX, $maxTs ); |
| 112 | + $copyPosUnix = wfTimestamp( TS_UNIX, $copyPos ); |
110 | 113 | |
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 | + } |
113 | 119 | printf( "%s %.2f%%\n", $copyPos, $percent ); |
114 | 120 | |
115 | 121 | # Handle all entries with timestamp equal to $copyPos |