Page MenuHomePhabricator

Change $wguname/$wgNodeName/wfHostname behaviour
Closed, ResolvedPublic

Description

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.


Version: 1.12.x
Severity: normal

attachment nodename.patch ignored as obsolete

Details

Reference
bz12586

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:05 PM
bzimport set Reference to bz12586.

Created attachment 4540
new patch

Sorry, i didn't see there was a syntax error in the other patch, now fixed.

Attached:

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.