*use $wgRateLimitsExcludedGroups for account creation (bug 9139) (patch by simetrical)
authorAaron Schulz <aaron@users.mediawiki.org>
Tue, 6 Mar 2007 04:29:37 +0000 (04:29 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Tue, 6 Mar 2007 04:29:37 +0000 (04:29 +0000)
includes/SpecialUserlogin.php
includes/User.php

index 8b652aa..3787c5e 100644 (file)
@@ -272,7 +272,7 @@ class LoginForm {
                        return false;
                }
 
-               if ( $wgAccountCreationThrottle ) {
+               if ( $wgAccountCreationThrottle && $wgUser->isPingLimitable() ) {
                        $key = wfMemcKey( 'acctcreate', 'ip', $ip );
                        $value = $wgMemc->incr( $key );
                        if ( !$value ) {
index 6ad546d..56f249a 100644 (file)
@@ -939,6 +939,15 @@ class User {
                return $found;
        }
 
+       /**
+        * Is this user subject to rate limiting?
+        *
+        * @return bool
+        */
+       public function isPingLimitable() {
+               return array_intersect($this->getEffectiveGroups(), $wgRateLimitsExcludedGroups) != array();
+       }
+
        /**
         * Primitive rate limits: enforce maximum actions per time period
         * to put a brake on flooding.
@@ -963,10 +972,8 @@ class User {
                }
                
                # Some groups shouldn't trigger the ping limiter, ever
-               foreach( $this->getGroups() as $group ) {
-                       if( array_search( $group, $wgRateLimitsExcludedGroups ) !== false )
-                               return false;
-               }
+               if( !$this->isPingLimitable() )
+                       return false;
                
                global $wgMemc, $wgRateLimitLog;
                wfProfileIn( __METHOD__ );