From 9d6a7cd12f42687fb87233f56f155823ff6674df Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 6 Mar 2007 04:29:37 +0000 Subject: [PATCH] *use $wgRateLimitsExcludedGroups for account creation (bug 9139) (patch by simetrical) --- includes/SpecialUserlogin.php | 2 +- includes/User.php | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) 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__ ); -- 2.20.1