From: Alexandre Emsenhuber Date: Mon, 20 Oct 2014 17:29:31 +0000 (+0200) Subject: Get the value of microtime() directly as float in updateSpecialPages.php X-Git-Tag: 1.31.0-rc.0~13561^2 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=9a99072827d93d70d4140993c49c338661fe5abf;p=lhc%2Fweb%2Fwiklou.git Get the value of microtime() directly as float in updateSpecialPages.php It has a first parameter to directly get the value as float, so use it instead of doing string manipulation. Change-Id: Id2dff4486ea4f308ce03fc3d5546660c4e3c26b6 --- diff --git a/maintenance/updateSpecialPages.php b/maintenance/updateSpecialPages.php index 61642828c9..d67ef6bb1a 100644 --- a/maintenance/updateSpecialPages.php +++ b/maintenance/updateSpecialPages.php @@ -81,16 +81,16 @@ class UpdateSpecialPages extends Maintenance { if ( !$this->hasOption( 'only' ) || $this->getOption( 'only' ) == $queryPage->getName() ) { $this->output( sprintf( '%-30s [QueryPage] ', $special ) ); if ( $queryPage->isExpensive() ) { - $t1 = explode( ' ', microtime() ); + $t1 = microtime( true ); # Do the query $num = $queryPage->recache( $limit === null ? $wgQueryCacheLimit : $limit ); - $t2 = explode( ' ', microtime() ); + $t2 = microtime( true ); if ( $num === false ) { $this->output( "FAILED: database error\n" ); } else { $this->output( "got $num rows in " ); - $elapsed = ( $t2[0] - $t1[0] ) + ( $t2[1] - $t1[1] ); + $elapsed = $t2 - $t1; $hours = intval( $elapsed / 3600 ); $minutes = intval( $elapsed % 3600 / 60 ); $seconds = $elapsed - $hours * 3600 - $minutes * 60; @@ -139,12 +139,12 @@ class UpdateSpecialPages extends Maintenance { continue; } $this->output( sprintf( '%-30s [callback] ', $special ) ); - $t1 = explode( ' ', microtime() ); + $t1 = microtime( true ); call_user_func( $call, $dbw ); - $t2 = explode( ' ', microtime() ); + $t2 = microtime( true ); $this->output( "completed in " ); - $elapsed = ( $t2[0] - $t1[0] ) + ( $t2[1] - $t1[1] ); + $elapsed = $t2 - $t1; $hours = intval( $elapsed / 3600 ); $minutes = intval( $elapsed % 3600 / 60 ); $seconds = $elapsed - $hours * 3600 - $minutes * 60;