From: Aaron Schulz Date: Thu, 18 Aug 2016 20:23:33 +0000 (-0700) Subject: Send new account and password reset emails post-commit X-Git-Tag: 1.31.0-rc.0~5999^2 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=74516df1067461b2a93b80eccdf9a14485d6a38c;p=lhc%2Fweb%2Fwiklou.git Send new account and password reset emails post-commit Change-Id: I8f1bd3e882e20fefa5ce0167202d511aa066cfe2 --- diff --git a/includes/auth/TemporaryPasswordPrimaryAuthenticationProvider.php b/includes/auth/TemporaryPasswordPrimaryAuthenticationProvider.php index 46cbab5a3a..ed94c1ad2b 100644 --- a/includes/auth/TemporaryPasswordPrimaryAuthenticationProvider.php +++ b/includes/auth/TemporaryPasswordPrimaryAuthenticationProvider.php @@ -303,7 +303,11 @@ class TemporaryPasswordPrimaryAuthenticationProvider ); if ( $sendMail ) { - $this->sendPasswordResetEmail( $req ); + // Send email after DB commit + $dbw->onTransactionIdle( function () use ( $req ) { + /** @var TemporaryPasswordAuthenticationRequest $req */ + $this->sendPasswordResetEmail( $req ); + } ); } } @@ -370,7 +374,10 @@ class TemporaryPasswordPrimaryAuthenticationProvider $this->providerChangeAuthenticationData( $req ); if ( $mailpassword ) { - $this->sendNewAccountEmail( $user, $creator, $req->password ); + // Send email after DB commit + wfGetDB( DB_MASTER )->onTransactionIdle( function () use ( $user, $creator, $req ) { + $this->sendNewAccountEmail( $user, $creator, $req->password ); + } ); } return $mailpassword ? 'byemail' : null;