From: Aaron Schulz Date: Tue, 6 Mar 2007 04:29:37 +0000 (+0000) Subject: *use $wgRateLimitsExcludedGroups for account creation (bug 9139) (patch by simetrical) X-Git-Tag: 1.31.0-rc.0~53898 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22auteur_infos%22%2C%20%22id_auteur=%24id%22%29%20.%20%22?a=commitdiff_plain;h=9d6a7cd12f42687fb87233f56f155823ff6674df;p=lhc%2Fweb%2Fwiklou.git *use $wgRateLimitsExcludedGroups for account creation (bug 9139) (patch by simetrical) --- diff --git a/includes/SpecialUserlogin.php b/includes/SpecialUserlogin.php index 8b652aab02..3787c5e529 100644 --- a/includes/SpecialUserlogin.php +++ b/includes/SpecialUserlogin.php @@ -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 ) { diff --git a/includes/User.php b/includes/User.php index 6ad546df23..56f249a74a 100644 --- a/includes/User.php +++ b/includes/User.php @@ -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__ );