r112050 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112049‎ | r112050 | r112051 >
Date:22:00, 21 February 2012
Author:awjrichards
Status:ok
Tags:
Comment:
Refactors the check if a particular IP is in the list of configured squid servers into its own function.
Modified paths:
  • /trunk/phase3/includes/ProxyTools.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ProxyTools.php
@@ -53,11 +53,20 @@
5454 * @return bool
5555 */
5656 function wfIsTrustedProxy( $ip ) {
 57+ $trusted = wfIsConfiguredProxy( $ip );
 58+ wfRunHooks( 'IsTrustedProxy', array( &$ip, &$trusted ) );
 59+ return $trusted;
 60+}
 61+
 62+/**
 63+ * Checks if an IP matches a proxy we've configured.
 64+ * @param $ip String
 65+ * @return bool
 66+ */
 67+function wfIsConfiguredProxy( $ip ) {
5768 global $wgSquidServers, $wgSquidServersNoPurge;
58 -
5969 $trusted = in_array( $ip, $wgSquidServers ) ||
6070 in_array( $ip, $wgSquidServersNoPurge );
61 - wfRunHooks( 'IsTrustedProxy', array( &$ip, &$trusted ) );
6271 return $trusted;
6372 }
6473

Status & tagging log