From: Brion Vibber Date: Fri, 4 Jun 2004 17:51:09 +0000 (+0000) Subject: Fix for bug #966376. If POSIX functions are unavailable due to running X-Git-Tag: 1.5.0alpha1~3035 X-Git-Url: http://git.cyclocoop.org/geomaker.php?a=commitdiff_plain;h=0c7a11c91b388651fbf46b4abeac04aad8d64996;p=lhc%2Fweb%2Fwiklou.git Fix for bug #966376. If POSIX functions are unavailable due to running on Windows or explicit disabling, use SERVER_NAME to provide a hostname. This may be a virtual server name. --- diff --git a/includes/OutputPage.php b/includes/OutputPage.php index c83dba4415..b2fb915b37 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -415,8 +415,16 @@ class OutputPage { list( $usec, $sec ) = explode( " ", $wgRequestTime ); $start = (float)$sec + (float)$usec; $elapsed = $now - $start; - $uname = posix_uname(); - $hostname = $uname['nodename']; + + # Use real server name if available, so we know which machine + # in a server farm generated the current page. + $uname = @posix_uname(); + if( is_array( $uname ) && isset( $uname['nodename'] ) ) { + $hostname = $uname['nodename']; + } else { + # This may be a virtual server. + $hostname = $_SERVER['SERVER_NAME']; + } $com = sprintf( "", $hostname, $elapsed ); return $com;