Merge "Expand the protocol for proto-relative links when printing"
[lhc/web/wiklou.git] / includes / GlobalFunctions.php
index 5174b32..b132826 100644 (file)
@@ -1817,19 +1817,23 @@ function wfHostname() {
 }
 
 /**
- * Returns a HTML comment with the elapsed time since request.
- * This method has no side effects.
+ * Returns a script tag that stores the amount of time it took MediaWiki to
+ * handle the request in milliseconds as 'wgBackendResponseTime'.
+ *
+ * If $wgShowHostnames is true, the script will also set 'wgHostname' to the
+ * hostname of the server handling the request.
  *
  * @return string
  */
 function wfReportTime() {
        global $wgRequestTime, $wgShowHostnames;
 
-       $elapsed = microtime( true ) - $wgRequestTime;
-
-       return $wgShowHostnames
-               ? sprintf( '<!-- Served by %s in %01.3f secs. -->', wfHostname(), $elapsed )
-               : sprintf( '<!-- Served in %01.3f secs. -->', $elapsed );
+       $responseTime = round( ( microtime( true ) - $wgRequestTime ) * 1000 );
+       $reportVars = array( 'wgBackendResponseTime' => $responseTime );
+       if ( $wgShowHostnames ) {
+               $reportVars[ 'wgHostname' ] = wfHostname();
+       }
+       return Skin::makeVariablesScript( $reportVars );
 }
 
 /**
@@ -1996,7 +2000,7 @@ function wfShowingResults( $offset, $limit ) {
  * @param string $query optional URL query parameter string
  * @param bool $atend optional param for specified if this is the last page
  * @return string
- * @deprecated in 1.19; use Language::viewPrevNext() instead
+ * @deprecated since 1.19; use Language::viewPrevNext() instead
  */
 function wfViewPrevNext( $offset, $limit, $link, $query = '', $atend = false ) {
        wfDeprecated( __METHOD__, '1.19' );
@@ -2877,15 +2881,6 @@ function wfShellExec( $cmd, &$retval = null, $environ = array(),
        if ( $useLogPipe ) {
                $desc[3] = array( 'pipe', 'w' );
        }
-
-       # TODO/FIXME: This is a bad hack to workaround an HHVM bug that prevents
-       # proc_open() from opening stdin/stdout, so use /dev/null *for now*
-       # See bug 56597 / https://github.com/facebook/hhvm/issues/1247 for more info
-       if ( wfIsHHVM() ) {
-               $desc[0] = array( 'file', '/dev/null', 'r' );
-               $desc[2] = array( 'file', '/dev/null', 'w' );
-       }
-
        $pipes = null;
        $proc = proc_open( $cmd, $desc, $pipes );
        if ( !$proc ) {
@@ -4143,7 +4138,7 @@ function wfCanIPUseHTTPS( $ip ) {
  * Work out the IP address based on various globals
  * For trusted proxies, use the XFF client IP (first of the chain)
  *
- * @deprecated in 1.19; call $wgRequest->getIP() directly.
+ * @deprecated since 1.19; call $wgRequest->getIP() directly.
  * @return string
  */
 function wfGetIP() {