mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-11-24 00:04:15 +00:00
Merge "Moved up shouldCheck() short-circuit logic a bit"
This commit is contained in:
commit
78cc7ffd06
28
SimpleCaptcha/Captcha.php
Normal file → Executable file
28
SimpleCaptcha/Captcha.php
Normal file → Executable file
|
@ -289,6 +289,18 @@ class SimpleCaptcha {
|
|||
* @return bool true if the captcha should run
|
||||
*/
|
||||
function shouldCheck( WikiPage $page, $content, $section, $isContent = false, $oldtext = null ) {
|
||||
global $wgUser, $ceAllowConfirmedEmail;
|
||||
|
||||
if ( $wgUser->isAllowed( 'skipcaptcha' ) ) {
|
||||
wfDebug( "ConfirmEdit: user group allows skipping captcha\n" );
|
||||
return false;
|
||||
} elseif ( $this->isIPWhitelisted() ) {
|
||||
return false;
|
||||
} elseif ( $ceAllowConfirmedEmail && $wgUser->isEmailConfirmed() ) {
|
||||
wfDebug( "ConfirmEdit: user has confirmed mail, skipping captcha\n" );
|
||||
return false;
|
||||
}
|
||||
|
||||
$title = $page->getTitle();
|
||||
$this->trigger = '';
|
||||
|
||||
|
@ -311,22 +323,6 @@ class SimpleCaptcha {
|
|||
$isEmpty = $content === '';
|
||||
}
|
||||
|
||||
global $wgUser;
|
||||
if ( $wgUser->isAllowed( 'skipcaptcha' ) ) {
|
||||
wfDebug( "ConfirmEdit: user group allows skipping captcha\n" );
|
||||
return false;
|
||||
}
|
||||
if ( $this->isIPWhitelisted() )
|
||||
return false;
|
||||
|
||||
|
||||
global $wgEmailAuthentication, $ceAllowConfirmedEmail;
|
||||
if ( $wgEmailAuthentication && $ceAllowConfirmedEmail &&
|
||||
$wgUser->isEmailConfirmed() ) {
|
||||
wfDebug( "ConfirmEdit: user has confirmed mail, skipping captcha\n" );
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( $this->captchaTriggers( $title, 'edit' ) ) {
|
||||
// Check on all edits
|
||||
global $wgUser;
|
||||
|
|
Loading…
Reference in a new issue