From: Brad Jorsch Date: Tue, 12 Jul 2016 17:35:10 +0000 (-0400) Subject: AuthManager: Commit transaction after auto-creating a user X-Git-Tag: 1.31.0-rc.0~6394 X-Git-Url: http://git.cyclocoop.org/wiki/Target_page?a=commitdiff_plain;h=83c66caa0831086db7c2033ddda38106584060d0;p=lhc%2Fweb%2Fwiklou.git AuthManager: Commit transaction after auto-creating a user As things stand now, DBO_TRX or DBO_DEFAULT will cause a transaction to be started, and then anything in the entire request failing will probably cause the newly-added user row to be lost. But updates to external databases (e.g. CentralAuth) likely won't be since those DB connections were probably shut down after the update was completed. So let's explicitly commit changes af the end of auto-creation so that problems with the request itself don't undo it. Bug: T119736 Change-Id: I6c13c8feb86d8b9a01df894733c38445d048fea0 --- diff --git a/includes/auth/AuthManager.php b/includes/auth/AuthManager.php index 6db5f2c625..82eeff0c4e 100644 --- a/includes/auth/AuthManager.php +++ b/includes/auth/AuthManager.php @@ -1695,6 +1695,10 @@ class AuthManager implements LoggerAwareInterface { $logid = $logEntry->insert(); } + // Commit database changes, so even if something else later blows up + // the newly-created user doesn't get lost. + wfGetLBFactory()->commitMasterChanges( __METHOD__ ); + if ( $login ) { $this->setSessionDataForUser( $user ); }