Fix for r51774, r51784: set '127.0.0.1' as IP for CLI, but with explicit check for...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Fri, 12 Jun 2009 09:34:49 +0000 (09:34 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Fri, 12 Jun 2009 09:34:49 +0000 (09:34 +0000)
includes/ProxyTools.php

index fe31376..bb5c85a 100644 (file)
@@ -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;