From: Brad Jorsch Date: Thu, 18 Feb 2016 16:13:00 +0000 (-0500) Subject: SessionManager: Autocreate should use READ_LATEST when necessary X-Git-Tag: 1.31.0-rc.0~7912^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=a30ca127b7377f97cf6cae6b6e224cea3d53c6c9;p=lhc%2Fweb%2Fwiklou.git SessionManager: Autocreate should use READ_LATEST when necessary If we failed to fetch the user ID using the default flags but succeeded with READ_LATEST, we should also be passing READ_LATEST to $user->loadFromId(). Change-Id: If8fc332810c2703773a153760ad076c398a84e4e --- diff --git a/includes/session/SessionManager.php b/includes/session/SessionManager.php index 5573ec7af3..f1ace2c24f 100644 --- a/includes/session/SessionManager.php +++ b/includes/session/SessionManager.php @@ -358,19 +358,21 @@ final class SessionManager implements SessionManagerInterface { // Try the local user from the slave DB $localId = User::idFromName( $user->getName() ); + $flags = 0; // Fetch the user ID from the master, so that we don't try to create the user // when they already exist, due to replication lag // @codeCoverageIgnoreStart if ( !$localId && wfGetLB()->getReaderIndex() != 0 ) { $localId = User::idFromName( $user->getName(), User::READ_LATEST ); + $flags = User::READ_LATEST; } // @codeCoverageIgnoreEnd if ( $localId ) { // User exists after all. $user->setId( $localId ); - $user->loadFromId(); + $user->loadFromId( $flags ); return false; }