When running a maintenance script, this is printed in console if E_NOTICE is enabled for PHP error reporting:
PHP Notice: Undefined index: SERVER_NAME in /home/jesus/git/mediawiki/core/includes/GlobalFunctions.php on line 1505
Apparently there's no check/sane default when running scripts from cli. $_SERVER is obviously not available in this scenario:
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(); } else { $uname = false; } if ( is_array( $uname ) && isset( $uname['nodename'] ) ) { $host = $uname['nodename']; } elseif ( getenv( 'COMPUTERNAME' ) ) { # Windows computer name $host = getenv( 'COMPUTERNAME' ); } else { # This may be a virtual server. $host = $_SERVER['SERVER_NAME']; } } return $host; }
It can be resolved by defining $wgOverrideHostname in LocalSettings.php as a workaround.