From e4ab0f83db3126ab02efbd02e8210e45fe6a8e77 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Tue, 4 Sep 2012 21:05:40 +0200 Subject: [PATCH] Remove usage of wfTime() in maintenance This function is only a wrapper to microtime( true ), so it can easily be replaced and deprecated at some point. Change-Id: I26f77d3cb02cc517ecf51262a4684084a7ce7825 --- maintenance/backup.inc | 8 ++++---- maintenance/backupTextPass.inc | 6 +++--- maintenance/cleanupTable.inc | 4 ++-- maintenance/dumpIterator.php | 4 ++-- maintenance/importDump.php | 4 ++-- maintenance/rebuildImages.php | 4 ++-- maintenance/renderDump.php | 4 ++-- maintenance/upgrade1_5.php | 4 ++-- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/maintenance/backup.inc b/maintenance/backup.inc index 04c65ba159..e3dc488b54 100644 --- a/maintenance/backup.inc +++ b/maintenance/backup.inc @@ -259,7 +259,7 @@ class BackupDumper { $dbr = wfGetDB( DB_SLAVE ); } $this->maxCount = $dbr->selectField( $table, "MAX($field)", '', __METHOD__ ); - $this->startTime = wfTime(); + $this->startTime = microtime( true ); $this->lastTime = $this->startTime; $this->ID = getmypid(); } @@ -328,9 +328,9 @@ class BackupDumper { function showReport() { if ( $this->reporting ) { $now = wfTimestamp( TS_DB ); - $nowts = wfTime(); - $deltaAll = wfTime() - $this->startTime; - $deltaPart = wfTime() - $this->lastTime; + $nowts = microtime( true ); + $deltaAll = $nowts - $this->startTime; + $deltaPart = $nowts - $this->lastTime; $this->pageCountPart = $this->pageCount - $this->pageCountLast; $this->revCountPart = $this->revCount - $this->revCountLast; diff --git a/maintenance/backupTextPass.inc b/maintenance/backupTextPass.inc index 84aac57f12..f1f0954617 100644 --- a/maintenance/backupTextPass.inc +++ b/maintenance/backupTextPass.inc @@ -247,9 +247,9 @@ class TextPassDumper extends BackupDumper { if ( $this->reporting ) { $now = wfTimestamp( TS_DB ); - $nowts = wfTime(); - $deltaAll = wfTime() - $this->startTime; - $deltaPart = wfTime() - $this->lastTime; + $nowts = microtime( true ); + $deltaAll = $nowts - $this->startTime; + $deltaPart = $nowts - $this->lastTime; $this->pageCountPart = $this->pageCount - $this->pageCountLast; $this->revCountPart = $this->revCount - $this->revCountLast; diff --git a/maintenance/cleanupTable.inc b/maintenance/cleanupTable.inc index 85911ba7c8..57acfd8211 100644 --- a/maintenance/cleanupTable.inc +++ b/maintenance/cleanupTable.inc @@ -62,7 +62,7 @@ class TableCleanup extends Maintenance { $this->processed = 0; $this->updated = 0; $this->count = $count; - $this->startTime = wfTime(); + $this->startTime = microtime( true ); $this->table = $table; } @@ -75,7 +75,7 @@ class TableCleanup extends Maintenance { $portion = $this->processed / $this->count; $updateRate = $this->updated / $this->processed; - $now = wfTime(); + $now = microtime( true ); $delta = $now - $this->startTime; $estimatedTotalTime = $delta / $portion; $eta = $this->startTime + $estimatedTotalTime; diff --git a/maintenance/dumpIterator.php b/maintenance/dumpIterator.php index 485218ca88..3657f960f7 100644 --- a/maintenance/dumpIterator.php +++ b/maintenance/dumpIterator.php @@ -62,7 +62,7 @@ abstract class DumpIterator extends Maintenance { return; } - $this->startTime = wfTime(); + $this->startTime = microtime( true ); if ( $this->getOption('dump') == '-' ) { $source = new ImportStreamSource( $this->getStdin() ); @@ -80,7 +80,7 @@ abstract class DumpIterator extends Maintenance { $this->conclusions(); - $delta = wfTime() - $this->startTime; + $delta = microtime( true ) - $this->startTime; $this->error( "Done {$this->count} revisions in " . round($delta, 2) . " seconds " ); if ($delta > 0) $this->error( round($this->count / $delta, 2) . " pages/sec" ); diff --git a/maintenance/importDump.php b/maintenance/importDump.php index b089f70a35..f51d7ad732 100644 --- a/maintenance/importDump.php +++ b/maintenance/importDump.php @@ -208,7 +208,7 @@ TEXT; function showReport() { if ( !$this->mQuiet ) { - $delta = wfTime() - $this->startTime; + $delta = microtime( true ) - $this->startTime; if ( $delta ) { $rate = sprintf( "%.2f", $this->pageCount / $delta ); $revrate = sprintf( "%.2f", $this->revCount / $delta ); @@ -254,7 +254,7 @@ TEXT; } function importFromHandle( $handle ) { - $this->startTime = wfTime(); + $this->startTime = microtime( true ); $source = new ImportStreamSource( $handle ); $importer = new WikiImporter( $source ); diff --git a/maintenance/rebuildImages.php b/maintenance/rebuildImages.php index f5d06e4620..2842b4022b 100644 --- a/maintenance/rebuildImages.php +++ b/maintenance/rebuildImages.php @@ -91,7 +91,7 @@ class ImageBuilder extends Maintenance { $this->processed = 0; $this->updated = 0; $this->count = $count; - $this->startTime = wfTime(); + $this->startTime = microtime( true ); $this->table = $table; } @@ -104,7 +104,7 @@ class ImageBuilder extends Maintenance { $portion = $this->processed / $this->count; $updateRate = $this->updated / $this->processed; - $now = wfTime(); + $now = microtime( true ); $delta = $now - $this->startTime; $estimatedTotalTime = $delta / $portion; $eta = $this->startTime + $estimatedTotalTime; diff --git a/maintenance/renderDump.php b/maintenance/renderDump.php index b25fb9485e..24bedfa4b4 100644 --- a/maintenance/renderDump.php +++ b/maintenance/renderDump.php @@ -52,7 +52,7 @@ class DumpRenderer extends Maintenance { public function execute() { $this->outputDirectory = $this->getOption( 'output-dir' ); $this->prefix = $this->getOption( 'prefix', 'wiki' ); - $this->startTime = wfTime(); + $this->startTime = microtime( true ); if ( $this->hasOption( 'parser' ) ) { global $wgParserConf; @@ -68,7 +68,7 @@ class DumpRenderer extends Maintenance { $importer->doImport(); - $delta = wfTime() - $this->startTime; + $delta = microtime( true ) - $this->startTime; $this->error( "Rendered {$this->count} pages in " . round($delta, 2) . " seconds " ); if ($delta > 0) $this->error( round($this->count / $delta, 2) . " pages/sec" ); diff --git a/maintenance/upgrade1_5.php b/maintenance/upgrade1_5.php index 13faece19d..1e268de3ee 100644 --- a/maintenance/upgrade1_5.php +++ b/maintenance/upgrade1_5.php @@ -252,7 +252,7 @@ class FiveUpgrade extends Maintenance { $this->chunkSize = $chunksize; $this->chunkFinal = $final; $this->chunkCount = 0; - $this->chunkStartTime = wfTime(); + $this->chunkStartTime = microtime( true ); $this->chunkOptions = array( 'IGNORE' ); $this->chunkTable = $table; $this->chunkFunction = $fname; @@ -273,7 +273,7 @@ class FiveUpgrade extends Maintenance { $this->insertChunk( $chunk ); $this->chunkCount += count( $chunk ); - $now = wfTime(); + $now = microtime( true ); $delta = $now - $this->chunkStartTime; $rate = $this->chunkCount / $delta; -- 2.20.1