diff --git a/RELEASE-NOTES-1.19 b/RELEASE-NOTES-1.19 index 1dd51038697..a59e47dea0f 100644 --- a/RELEASE-NOTES-1.19 +++ b/RELEASE-NOTES-1.19 @@ -45,6 +45,7 @@ production. although they are not used there. * (bug 30451) Add page_props to RefreshLinks::deleteLinksFromNonexistent * (bug 30450) Clear page_props table on page deletion +* Hook added to check for exempt from account creation throttle === Bug fixes in 1.19 === * $wgUploadNavigationUrl should be used for file redlinks if diff --git a/docs/hooks.txt b/docs/hooks.txt index a120aa9efd2..0ee7e6f7c40 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -849,6 +849,9 @@ $user: The user who is trying to email another user. $editToken: The user's edit token. &$hookErr: Out-param for the error. Passed as the parameters to OutputPage::showErrorPage. +'exemptFromAccountCreationThrottle': Exemption from the account creation throttle +$ip: The ip address of the user + 'ExtensionTypes': called when generating the extensions credits, use this to change the tables headers &$extTypes: associative array of extensions types diff --git a/includes/specials/SpecialUserlogin.php b/includes/specials/SpecialUserlogin.php index ee4d617ff7b..ae89765988c 100644 --- a/includes/specials/SpecialUserlogin.php +++ b/includes/specials/SpecialUserlogin.php @@ -377,17 +377,23 @@ class LoginForm extends SpecialPage { return false; } - if ( $wgAccountCreationThrottle && $wgUser->isPingLimitable() ) { - $key = wfMemcKey( 'acctcreate', 'ip', $ip ); - $value = $wgMemc->get( $key ); - if ( !$value ) { - $wgMemc->set( $key, 0, 86400 ); + // Hook point to check for exempt from account creation throttle + if ( !wfRunHooks( 'exemptFromAccountCreationThrottle', array( $ip ) ) ) { + wfDebug( "LoginForm::exemptFromAccountCreationThrottle: a hook allowed account creation w/o throttle\n" ); + } else { + if ( ( $wgAccountCreationThrottle && $wgUser->isPingLimitable() ) ) { + wfDebugLog( 'CACT', "IN der core Throttle Abfrage\n" ); + $key = wfMemcKey( 'acctcreate', 'ip', $ip ); + $value = $wgMemc->get( $key ); + if ( !$value ) { + $wgMemc->set( $key, 0, 86400 ); + } + if ( $value >= $wgAccountCreationThrottle ) { + $this->throttleHit( $wgAccountCreationThrottle ); + return false; + } + $wgMemc->incr( $key ); } - if ( $value >= $wgAccountCreationThrottle ) { - $this->throttleHit( $wgAccountCreationThrottle ); - return false; - } - $wgMemc->incr( $key ); } if( !$wgAuth->addUser( $u, $this->mPassword, $this->mEmail, $this->mRealName ) ) {