From: Aaron Schulz Date: Thu, 28 Jun 2012 18:03:45 +0000 (+0000) Subject: Merge "setting to completely override server hostname" X-Git-Tag: 1.31.0-rc.0~23204 X-Git-Url: http://git.heureux-cyclage.org/?a=commitdiff_plain;h=a69ebb07a72153b79950cd979b6e6775a169c75c;hp=8d2b9a2a4f70b4d6b9b5db9d4f6fd4817084fac2;p=lhc%2Fweb%2Fwiklou.git Merge "setting to completely override server hostname" --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 6e59a86eb9..35ae6bda3c 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -4186,6 +4186,13 @@ $wgLogExceptionBacktrace = true; */ $wgShowHostnames = false; +/** + * Override server hostname detection with a hardcoded value. + * Should be a string, default false. + * @since 1.20 + */ +$wgOverrideHostname = false; + /** * If set to true MediaWiki will throw notices for some possible error * conditions and for deprecated functions. diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index ba9bf74556..7e759580de 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1758,6 +1758,15 @@ function wfDebugDieBacktrace( $msg = '' ) { function wfHostname() { static $host; if ( is_null( $host ) ) { + + # Hostname overriding + global $wgOverrideHostname; + if( $wgOverrideHostname !== false ) { + # Set static and skip any detection + $host = $wgOverrideHostname; + return $host; + } + if ( function_exists( 'posix_uname' ) ) { // This function not present on Windows $uname = posix_uname();