From 4bf384a4df0435be8b0909536cb094d4ac6ae545 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 16 Dec 2008 18:43:42 +0000 Subject: [PATCH] Throw in quick hack $wgRateLimitsExcludedIPs so we don't have to do a live hack every time somebody runs an exciting event where they're going to register a lot of accounts. Should be killed and replaced with an on-wiki system for approvals or temporary lifting of limits as a sort of anti-block. --- includes/DefaultSettings.php | 10 ++++++++++ includes/User.php | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 6a00a8c092..28a91d5feb 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -3204,6 +3204,16 @@ $wgRateLimitLog = null; */ $wgRateLimitsExcludedGroups = array(); +/** + * Array of IPs which should never trigger the rate limiter. + * Really this is a cruddy hack and should be replaced with + * an "anti-block" or something which can be managed through + * the wiki UI. + * + * $wgRateLimitsExcludedIPs = array( '1.2.3.4' ); + */ +$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 85701e320d..bd0fe3aac2 100644 --- a/includes/User.php +++ b/includes/User.php @@ -1146,10 +1146,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