Last modified: 2008-10-06 07:31:01 UTC
Created attachment 4532 [details] proposed patch Actually $wguname['nodename'] is used by Database.php and Profiler.php or $wguname isn't set on windows and other platforms where posix_uname() doesn't exist. I modified these files to use $wgNodeName wich contains the same value, i also modified Setup.php to use php_uname('n') wich return the computer's name on Windows (it is the case with my version of Windows XP) before $_SERVER['SERVER_NAME'] if posix_uname() is aviable. As this does now the same thing as wfHostname(), i modified this function to simply returns $wgNodeName. Maybe all this should be done in wfHostname() but i don't konw if an extension is using $wguname/$wgNodeName.
Created attachment 4540 [details] new patch Sorry, i didn't see there was a syntax error in the other patch, now fixed.
Tim, can you check this one on Windows?
The patch introduces $wgNodeName and uses it in several places. I'd rather use the global function wfHostname() rather than encourage the use of global variables that can't be lazy-initialised. $_SERVER['SERVER_NAME'] is set to the virtual host on my WAMP server. $_ENV['COMPUTERNAME'] is set to the computer name regardless of virtual host, perhaps that would be a better choice for Windows, assuming it's documented and reliable.
Indirect reference here: <http://msdn2.microsoft.com/en-us/library/system.environment.machinename.aspx> Implies the .NET framework property for getting the computer name does so by reading the COMPUTERNAME environment variable.
Fixed in r41733.