From 57290f6926e56498a6e76f52e00a4e5b9b2aedc1 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Fri, 16 Dec 2016 22:09:06 -0800 Subject: [PATCH] user: Minor clean up of User::isLocallyBlockedProxy() Change-Id: If8bcb2f26f14ce04ee23fb9500be95c8cdf1a967 --- includes/user/User.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/includes/user/User.php b/includes/user/User.php index 211c629750..663c5da4f8 100644 --- a/includes/user/User.php +++ b/includes/user/User.php @@ -1780,21 +1780,22 @@ class User implements IDBAccessObject { } if ( !is_array( $wgProxyList ) ) { - // Load from the specified file + // Load values from the specified file $wgProxyList = array_map( 'trim', file( $wgProxyList ) ); } - if ( !is_array( $wgProxyList ) ) { - $ret = false; - } elseif ( array_search( $ip, $wgProxyList ) !== false ) { - $ret = true; - } elseif ( array_key_exists( $ip, $wgProxyList ) ) { - // Old-style flipped proxy list - $ret = true; - } else { - $ret = false; + if ( is_array( $wgProxyList ) ) { + if ( + // Look for IP as value + array_search( $ip, $wgProxyList ) !== false || + // Look for IP as key (for backwards-compatility) + array_key_exists( $ip, $wgProxyList ) + ) { + return true; + } } - return $ret; + + return false; } /** -- 2.20.1