Make WebRequest objects time-aware
authorOri Livneh <ori@wikimedia.org>
Wed, 1 Apr 2015 23:16:09 +0000 (16:16 -0700)
committerOri Livneh <ori@wikimedia.org>
Thu, 2 Apr 2015 01:21:26 +0000 (18:21 -0700)
commit667fa3e264c6d3c68c5fcf1072d92ad1e6b62d46
treec66892e00412fa57aebc5a35698ec7a600beda45
parente36a953cc258be1ac909c07065be86ec7b7c68e3
Make WebRequest objects time-aware

* Deprecate $wgRequestTime in favor of $_SERVER['REQUEST_TIME_FLOAT'], which is
  more accurate. Because $_SERVER['REQUEST_TIME_FLOAT'] is only set for PHP
  5.4+, set it to microtime( true ) in WebStart.php for back-compatibility.
* Add a 'requestTime' property to WebRequest objects, set to
  $_SERVER['REQUEST_TIME_FLOAT'] for WebRequest or the instance creation time
  for FauxRequest instances.
* Use that to provide WebRequest::getElapsedTime(), which gets the time since
  the request was initiated.
* In wfLogProfilingData(), get the user and request objects from the context
  object rather than from global scope.

Opportunistic clean-up: move the magic quotes check to WebStart.php and make
the error message more helpful.

Change-Id: I7e07e22eaf16b5141b80ad9f843285c542a127b7
includes/GlobalFunctions.php
includes/WebRequest.php
includes/WebStart.php