Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/219954

Change subject: Moved up shouldCheck() short-circuit logic a bit
......................................................................

Moved up shouldCheck() short-circuit logic a bit

Change-Id: Idbae820131eba8427075c9a59292ecf243490543
---
M SimpleCaptcha/Captcha.php
1 file changed, 12 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ConfirmEdit 
refs/changes/54/219954/1

diff --git a/SimpleCaptcha/Captcha.php b/SimpleCaptcha/Captcha.php
old mode 100644
new mode 100755
index 997d4ce..dd4df43
--- a/SimpleCaptcha/Captcha.php
+++ b/SimpleCaptcha/Captcha.php
@@ -289,6 +289,18 @@
         * @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 = '';
 
@@ -309,22 +321,6 @@
                } else {
                        $newtext = $content;
                        $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' ) ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/219954
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idbae820131eba8427075c9a59292ecf243490543
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ConfirmEdit
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to