From 8b02329fd96544f758b9e030ecbba4cf10935bb1 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Mon, 19 Oct 2009 19:11:56 +0000 Subject: [PATCH] Reintroduced $wgRateLimitsExcludedIPs from r47352 (removed in r51045). $wgAutopromote does not work for anonymous users. --- RELEASE-NOTES | 2 ++ includes/DefaultSettings.php | 6 ++++++ includes/User.php | 9 ++++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 22b0ed963a..72fbe638f4 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -252,6 +252,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Rewrote Special:Upload to allow easier extension. * Upload errors that can be solved by changing the filename now do not require reuploading. +* Added $wgRateLimitsExcludedIPs, to allow specific IPs to be whitelisted from + rate limits. === Bug fixes in 1.16 === diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 80878160b4..b7a3395fb7 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -3581,6 +3581,12 @@ $wgRateLimitLog = null; */ $wgRateLimitsExcludedGroups = array(); +/** + * Array of IPs which should be excluded from rate limits. + * This may be useful for whitelisting NAT gateways for conferences, etc. + */ +$wgRateLimitsExcludedIPs = array(); + /** * On Special:Unusedimages, consider images "used", if they are put * into a category. Default (false) is not to count those as used. diff --git a/includes/User.php b/includes/User.php index 3549158700..9fd2598936 100644 --- a/includes/User.php +++ b/includes/User.php @@ -1219,11 +1219,18 @@ class User { */ public function isPingLimitable() { global $wgRateLimitsExcludedGroups; + global $wgRateLimitsExcludedIPs; if( array_intersect( $this->getEffectiveGroups(), $wgRateLimitsExcludedGroups ) ) { // Deprecated, but kept for backwards-compatibility config return false; } - return !$this->isAllowed( 'noratelimit' ); + if( in_array( wfGetIP(), $wgRateLimitsExcludedIPs ) ) { + // No other good way currently to disable rate limits + // for specific IPs. :P + // But this is a crappy hack and should die. + return false; + } + return !$this->isAllowed('noratelimit'); } /** -- 2.20.1