From 05e5a8196280f0aedc4a19deb26fca68068dad23 Mon Sep 17 00:00:00 2001 From: Arthur Richards Date: Tue, 21 Feb 2012 22:00:58 +0000 Subject: [PATCH] Refactors the check if a particular IP is in the list of configured squid servers into its own function. --- includes/ProxyTools.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/includes/ProxyTools.php b/includes/ProxyTools.php index bdab3be24f..aa4ce44041 100644 --- a/includes/ProxyTools.php +++ b/includes/ProxyTools.php @@ -53,11 +53,20 @@ function wfGetIP() { * @return bool */ function wfIsTrustedProxy( $ip ) { - global $wgSquidServers, $wgSquidServersNoPurge; + $trusted = wfIsConfiguredProxy( $ip ); + wfRunHooks( 'IsTrustedProxy', array( &$ip, &$trusted ) ); + return $trusted; +} +/** + * Checks if an IP matches a proxy we've configured. + * @param $ip String + * @return bool + */ +function wfIsConfiguredProxy( $ip ) { + global $wgSquidServers, $wgSquidServersNoPurge; $trusted = in_array( $ip, $wgSquidServers ) || in_array( $ip, $wgSquidServersNoPurge ); - wfRunHooks( 'IsTrustedProxy', array( &$ip, &$trusted ) ); return $trusted; } -- 2.20.1