From 0db6034cc4ad8ac65282b3b60f179bdc4e730c40 Mon Sep 17 00:00:00 2001 From: Nathaniel Herman Date: Sun, 30 Nov 2008 17:33:11 +0000 Subject: [PATCH] Fixed minor bug where the memcached value for how many accounts an IP had created that day would be increased even if $wgAccountCreationThrottle was hit. This meant if an IP hit the throttle and then the throttle was raised later that day, the IP still couldn't create another account, because it had marked them as having created another account, when their last account creation had actually failed. --- RELEASE-NOTES | 6 ++++++ includes/specials/SpecialUserlogin.php | 7 ++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index f16d1d94b7..d8315158aa 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -377,6 +377,12 @@ The following extensions are migrated into MediaWiki 1.14: now automatically removed from titles; these characters can accidentally end up in copy-and-pasted titles, and, by overriding normal bidirectional text handling, can lead to annoying behavior such as text rendering backwards +* Fixed minor bug where the memcached value for how many accounts an IP had + created that day would be increased even if $wgAccountCreationThrottle was + hit. This meant if an IP hit the throttle and then the throttle was raised + later that day, the IP still couldn't create another account, because it + had marked them as having created another account, when their last account + creation had actually failed. === API changes in 1.14 === diff --git a/includes/specials/SpecialUserlogin.php b/includes/specials/SpecialUserlogin.php index 75b065d65b..6a4da7a4ab 100644 --- a/includes/specials/SpecialUserlogin.php +++ b/includes/specials/SpecialUserlogin.php @@ -311,14 +311,15 @@ class LoginForm { if ( $wgAccountCreationThrottle && $wgUser->isPingLimitable() ) { $key = wfMemcKey( 'acctcreate', 'ip', $ip ); - $value = $wgMemc->incr( $key ); + $value = $wgMemc->get( $key ); if ( !$value ) { - $wgMemc->set( $key, 1, 86400 ); + $wgMemc->set( $key, 0, 86400 ); } - if ( $value > $wgAccountCreationThrottle ) { + if ( $value >= $wgAccountCreationThrottle ) { $this->throttleHit( $wgAccountCreationThrottle ); return false; } + $wgMemc->incr( $key ); } if( !$wgAuth->addUser( $u, $this->mPassword, $this->mEmail, $this->mRealName ) ) { -- 2.20.1