From 83c66caa0831086db7c2033ddda38106584060d0 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Tue, 12 Jul 2016 13:35:10 -0400 Subject: [PATCH] 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 --- includes/auth/AuthManager.php | 4 ++++ 1 file changed, 4 insertions(+) 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 ); } -- 2.20.1