Merge "setting to completely override server hostname"
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 28 Jun 2012 18:03:45 +0000 (18:03 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 28 Jun 2012 18:03:45 +0000 (18:03 +0000)
includes/DefaultSettings.php
includes/GlobalFunctions.php

index 6e59a86..35ae6bd 100644 (file)
@@ -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.
index ba9bf74..7e75958 100644 (file)
@@ -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();