From 72c40682dda25f853ab7b654e9d5f321ee58e98b Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Tue, 17 Feb 2009 03:17:19 +0000 Subject: [PATCH] Added $wgRateLimitsExcludedIPs feature, based on live hack. --- RELEASE-NOTES | 2 ++ includes/DefaultSettings.php | 8 +++++++- includes/User.php | 7 +++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 54bb87faea..c1e6da3c22 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -106,6 +106,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Remove the link to Special:FileDuplicateSearch from the "file history" section of image description pages as the list of duplicated files is shown in the next section anyway. +* Added $wgRateLimitsExcludedIPs, to allow specific IPs to be whitelisted from + rate limits. === Bug fixes in 1.15 === * (bug 16968) Special:Upload no longer throws useless warnings. diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index b27f7aaf9b..9cdb2f582d 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -3259,6 +3259,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. @@ -3718,4 +3724,4 @@ $wgUseTwoButtonsSearchForm = true; /** * Preprocessor caching threshold */ -$wgPreprocessorCacheThreshold = 1000; \ No newline at end of file +$wgPreprocessorCacheThreshold = 1000; diff --git a/includes/User.php b/includes/User.php index fea09d252d..81246a1190 100644 --- a/includes/User.php +++ b/includes/User.php @@ -1162,10 +1162,17 @@ class User { */ public function isPingLimitable() { global $wgRateLimitsExcludedGroups; + global $wgRateLimitsExcludedIPs; if( array_intersect( $this->getEffectiveGroups(), $wgRateLimitsExcludedGroups ) ) { // Deprecated, but kept for backwards-compatibility config return false; } + 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