IAlex has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/167630

Change subject: Use $_SERVER["REQUEST_TIME_FLOAT"] for $wgRequestTime if 
available
......................................................................

Use $_SERVER["REQUEST_TIME_FLOAT"] for $wgRequestTime if available

Since PHP 5.4, a new item in  $_SERVER that gets the epoch of the
request's begin, so use it if available instead of calling ourself
microtime( true ). The latter is still kept for PHP 5.3.

Change-Id: Id430578b30a49dd560eb27e8582279a2a9dc8629
---
M includes/WebStart.php
M maintenance/Maintenance.php
2 files changed, 13 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/30/167630/1

diff --git a/includes/WebStart.php b/includes/WebStart.php
index cb35ee5..85fb55f 100644
--- a/includes/WebStart.php
+++ b/includes/WebStart.php
@@ -39,7 +39,13 @@
 # points and when $wgOut gets disabled or overridden.
 header( 'X-Content-Type-Options: nosniff' );
 
-$wgRequestTime = microtime( true );
+# $_SERVER["REQUEST_TIME_FLOAT"] is available since PHP 5.4
+if ( isset( $_SERVER["REQUEST_TIME_FLOAT"] ) ) {
+       $wgRequestTime = $_SERVER["REQUEST_TIME_FLOAT"];
+} else {
+       $wgRequestTime = microtime( true );
+}
+
 unset( $IP );
 
 # Valid web server entry point, enable includes.
diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php
index 8d30df4..9c74e3c 100644
--- a/maintenance/Maintenance.php
+++ b/maintenance/Maintenance.php
@@ -554,8 +554,12 @@
                # But sometimes this doesn't seem to be the case.
                ini_set( 'max_execution_time', 0 );
 
-               $wgRequestTime = microtime( true );
-
+               # $_SERVER["REQUEST_TIME_FLOAT"] is available since PHP 5.4
+               if ( isset( $_SERVER["REQUEST_TIME_FLOAT"] ) ) {
+                       $wgRequestTime = $_SERVER["REQUEST_TIME_FLOAT"];
+               } else {
+                       $wgRequestTime = microtime( true );
+               }
                # Define us as being in MediaWiki
                define( 'MEDIAWIKI', true );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/167630
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id430578b30a49dd560eb27e8582279a2a9dc8629
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: IAlex <coderev...@emsenhuber.ch>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to