}
if( is_array( $uname ) && isset( $uname['nodename'] ) ) {
$host = $uname['nodename'];
+ } elseif ( getenv( 'COMPUTERNAME' ) ) {
+ # Windows computer name
+ $host = getenv( 'COMPUTERNAME' );
} else {
# This may be a virtual server.
$host = $_SERVER['SERVER_NAME'];
# Do not log anything if database is readonly (bug 5375)
if( wfReadOnly() ) { return; }
- # Warning: $wguname is a live patch, it should be moved to Setup.php
- global $wguname, $wgProfilePerHost;
+ global $wgProfilePerHost;
$dbw = wfGetDB( DB_MASTER );
if( !is_object( $dbw ) )
$name = substr($name, 0, 255);
if( $wgProfilePerHost ){
- $pfhost = $wguname['nodename'];
+ $pfhost = wfHostname();
} else {
$pfhost = '';
}
$wgIP = false; # Load on demand
# Can't stub this one, it sets up $_GET and $_REQUEST in its constructor
$wgRequest = new WebRequest;
-if ( function_exists( 'posix_uname' ) ) {
- $wguname = posix_uname();
- $wgNodeName = $wguname['nodename'];
-} else {
- $wgNodeName = '';
-}
# Useful debug output
if ( $wgCommandLineMode ) {
* If the failFunction is set to a non-zero integer, returns success
*/
function open( $server, $user, $password, $dbName ) {
- global $wguname, $wgAllDBsAreLocalhost;
+ global $wgAllDBsAreLocalhost;
wfProfileIn( __METHOD__ );
# Test for missing mysql.so
$success = @/**/mysql_select_db( $dbName, $this->mConn );
if ( !$success ) {
$error = "Error selecting database $dbName on server {$this->mServer} " .
- "from client host {$wguname['nodename']}\n";
+ "from client host " . wfHostname() . "\n";
wfLogDBError(" Error selecting database $dbName on server {$this->mServer} \n");
wfDebug( $error );
}
$success = @/**/mssql_select_db($dbName, $this->mConn);
if (!$success) {
$error = "Error selecting database $dbName on server {$this->mServer} " .
- "from client host {$wguname['nodename']}\n";
+ "from client host " . wfHostname() . "\n";
wfLogDBError(" Error selecting database $dbName on server {$this->mServer} \n");
wfDebug( $error );
}
$oldWiki = key( $this->mConns['foreignFree'][$i] );
if ( !$conn->selectDB( $dbName ) ) {
- global $wguname;
$this->mLastError = "Error selecting database $dbName on server " .
- $conn->getServer() . " from client host {$wguname['nodename']}\n";
+ $conn->getServer() . " from client host " . wfHostname() . "\n";
$this->mErrorConnection = $conn;
$conn = false;
} else {
* server node, and generator backend.
*/
protected function debug( $generator="internal" ) {
- global $wgShowHostnames, $wgNodeName;
+ global $wgShowHostnames;
$data = array( $generator );
if( $wgShowHostnames ) {
- $data[] = $wgNodeName;
+ $data[] = wfHostname();
}
$data[] = wfTimestamp( TS_DB );
return "<!-- diff generator: " .