SessionManager: Notify AuthPlugin when auto-creating accounts
authorBrad Jorsch <bjorsch@wikimedia.org>
Thu, 21 Jan 2016 20:20:44 +0000 (15:20 -0500)
committerBrad Jorsch <bjorsch@wikimedia.org>
Thu, 21 Jan 2016 20:22:09 +0000 (15:22 -0500)
Bug: T74791
Change-Id: Iabb44d58a922051ca2d70a052d6c53734a4f8936

includes/session/SessionManager.php

index 0e45468..c4f33d0 100644 (file)
@@ -496,6 +496,16 @@ final class SessionManager implements SessionManagerInterface {
                \Hooks::run( 'AuthPluginAutoCreate', array( $user ) );
                \Hooks::run( 'LocalUserCreated', array( $user, true ) );
 
+               # Notify AuthPlugin too
+               $tmpUser = $user;
+               $wgAuth->initUser( $tmpUser, true );
+               if ( $tmpUser !== $user ) {
+                       $logger->warning( __METHOD__ . ': ' .
+                               get_class( $wgAuth ) . '::initUser() replaced the user object' );
+               }
+
+               $user->saveSettings();
+
                # Update user count
                \DeferredUpdates::addUpdate( new \SiteStatsUpdate( 0, 0, 0, 0, 1 ) );