From 5b2c98b2ef0206d1c71ef9cd48f9a4dd016dac26 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Fri, 12 Jun 2009 09:34:49 +0000 Subject: [PATCH] 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. --- includes/ProxyTools.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; -- 2.20.1