Labs has instances hostnames forged in sequences which make them not
that much useful for human readable output. Labs does publish a
meaningful instance name as an env variable though, so we could use it
to get better output.
This patch introduce $wgOverrideHostname (default false) which when
set will override the hostname returned by wfHostname().
Change-Id: Ibdba007cc4025fa0b0ebef39b5669c32852a95a7
*/
$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.
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();