If isConfirmedEmail (already confirmed), skip dbtouch/hook call
authorMatthew Flaschen <mflaschen@wikimedia.org>
Thu, 28 Mar 2013 22:29:22 +0000 (18:29 -0400)
committerMatthew Flaschen <mflaschen@wikimedia.org>
Thu, 28 Mar 2013 22:30:52 +0000 (18:30 -0400)
Bug: 46655
Change-Id: I5ea64611f68e01b1e82cd9dbe564123e81b17ed9

includes/User.php

index cc97774..2b7c787 100644 (file)
@@ -3674,8 +3674,12 @@ class User {
         * @return bool
         */
        public function confirmEmail() {
-               $this->setEmailAuthenticationTimestamp( wfTimestampNow() );
-               wfRunHooks( 'ConfirmEmailComplete', array( $this ) );
+               // Check if it's already confirmed, so we don't touch the database
+               // and fire the ConfirmEmailComplete hook on redundant confirmations.
+               if ( !$this->isEmailConfirmed() ) {
+                       $this->setEmailAuthenticationTimestamp( wfTimestampNow() );
+                       wfRunHooks( 'ConfirmEmailComplete', array( $this ) );
+               }
                return true;
        }