From: Alexandre Emsenhuber Date: Fri, 12 Jun 2009 09:34:49 +0000 (+0000) Subject: Fix for r51774, r51784: set '127.0.0.1' as IP for CLI, but with explicit check for... X-Git-Tag: 1.31.0-rc.0~41407 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/password.php?a=commitdiff_plain;h=5b2c98b2ef0206d1c71ef9cd48f9a4dd016dac26;p=lhc%2Fweb%2Fwiklou.git Fix for r51774, r51784: set '127.0.0.1' as IP for CLI, but with explicit check for $wgCommandLineMode so that the exception "Unable to determine IP" is not thrown in this case. --- diff --git a/includes/ProxyTools.php b/includes/ProxyTools.php index fe31376eb6..bb5c85ab74 100644 --- a/includes/ProxyTools.php +++ b/includes/ProxyTools.php @@ -67,7 +67,7 @@ function wfGetAgent() { * @return string */ function wfGetIP() { - global $wgIP, $wgUsePrivateIPs; + global $wgIP, $wgUsePrivateIPs, $wgCommandLineMode; # Return cached result if ( !empty( $wgIP ) ) { @@ -81,6 +81,8 @@ function wfGetIP() { # Client connecting to this webserver if ( isset( $_SERVER['REMOTE_ADDR'] ) ) { $ip = IP::canonicalize( $_SERVER['REMOTE_ADDR'] ); + } elseif( $wgCommandLineMode ) { + $ip = '127.0.0.1'; } if( $ip ) { $ipchain[] = $ip;