diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2011-06-22 11:28:20 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2011-06-22 11:28:20 +0200 |
commit | 9db190c7e736ec8d063187d4241b59feaf7dc2d1 (patch) | |
tree | 46d1a0dee7febef5c2d57a9f7b972be16a163b3d /includes/ProxyTools.php | |
parent | 78677c7bbdcc9739f6c10c75935898a20e1acd9e (diff) |
update to MediaWiki 1.17.0
Diffstat (limited to 'includes/ProxyTools.php')
-rw-r--r-- | includes/ProxyTools.php | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/includes/ProxyTools.php b/includes/ProxyTools.php index 5719e3e8..13c19965 100644 --- a/includes/ProxyTools.php +++ b/includes/ProxyTools.php @@ -1,6 +1,7 @@ <?php /** * Functions for dealing with proxies + * * @file */ @@ -67,15 +68,15 @@ function wfGetAgent() { * @return string */ function wfGetIP() { - global $wgIP, $wgUsePrivateIPs, $wgCommandLineMode; + global $wgUsePrivateIPs, $wgCommandLineMode; + static $ip = false; # Return cached result - if ( !empty( $wgIP ) ) { - return $wgIP; + if ( !empty( $ip ) ) { + return $ip; } $ipchain = array(); - $ip = false; /* collect the originating ips */ # Client connecting to this webserver @@ -111,12 +112,14 @@ function wfGetIP() { } } + # Allow extensions to improve our guess + wfRunHooks( 'GetIP', array( &$ip ) ); + if( !$ip ) { throw new MWException( "Unable to determine IP" ); } wfDebug( "IP: $ip\n" ); - $wgIP = $ip; return $ip; } @@ -183,9 +186,12 @@ function wfProxyCheck() { /** * Convert a network specification in CIDR notation to an integer network and a number of bits + * + * @deprecated Call IP::parseCIDR() directly, will be removed in 1.19 * @return array(string, int) */ function wfParseCIDR( $range ) { + wfDeprecated( __FUNCTION__ ); return IP::parseCIDR( $range ); } |