Added $wgRateLimitsExcludedIPs feature, based on live hack.
authorTim Starling <tstarling@users.mediawiki.org>
Tue, 17 Feb 2009 03:17:19 +0000 (03:17 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Tue, 17 Feb 2009 03:17:19 +0000 (03:17 +0000)
RELEASE-NOTES
includes/DefaultSettings.php
includes/User.php

index 54bb87f..c1e6da3 100644 (file)
@@ -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.
index b27f7aa..9cdb2f5 100644 (file)
@@ -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;
index fea09d2..81246a1 100644 (file)
@@ -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');
        }