X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fspecials%2FSpecialEmailuser.php;h=30eb38d04aea20057ec7630c680c9a76ebd34204;hp=249be7f17fa9a658005262d5276d3f8116830005;hb=f73f2b320d8fe1eb03f78671584d455a2ff9f292;hpb=86f4025ceafaaa56231a94ac3878a4a665e6f825 diff --git a/includes/specials/SpecialEmailuser.php b/includes/specials/SpecialEmailuser.php index 249be7f17f..30eb38d04a 100644 --- a/includes/specials/SpecialEmailuser.php +++ b/includes/specials/SpecialEmailuser.php @@ -280,7 +280,9 @@ class SpecialEmailUser extends UnlistedSpecialPage { return "blockedemailuser"; } - if ( $user->pingLimiter( 'emailuser' ) ) { + // Check the ping limiter without incrementing it - we'll check it + // again later and increment it on a successful send + if ( $user->pingLimiter( 'emailuser', 0 ) ) { wfDebug( "Ping limiter triggered.\n" ); return 'actionthrottledtext'; @@ -376,6 +378,11 @@ class SpecialEmailUser extends UnlistedSpecialPage { $text .= $context->msg( 'emailuserfooter', $from->name, $to->name )->inContentLanguage()->text(); + // Check and increment the rate limits + if ( $context->getUser()->pingLimiter( 'emailuser' ) ) { + throw new ThrottledError(); + } + $error = false; if ( !Hooks::run( 'EmailUser', [ &$to, &$from, &$subject, &$text, &$error ] ) ) { if ( $error instanceof Status ) {