jenkins-bot has submitted this change and it was merged.

Change subject: SessionManager: Autocreate should use READ_LATEST when necessary
......................................................................


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
(cherry picked from commit a30ca127b7377f97cf6cae6b6e224cea3d53c6c9)
---
M includes/session/SessionManager.php
1 file changed, 3 insertions(+), 1 deletion(-)

Approvals:
  Krinkle: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/session/SessionManager.php 
b/includes/session/SessionManager.php
index 6e4f99c..48d8ea4 100644
--- a/includes/session/SessionManager.php
+++ b/includes/session/SessionManager.php
@@ -357,19 +357,21 @@
 
                // 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;
                }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/272828
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If8fc332810c2703773a153760ad076c398a84e4e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.27.0-wmf.14
Gerrit-Owner: Gergő Tisza <gti...@wikimedia.org>
Gerrit-Reviewer: Anomie <bjor...@wikimedia.org>
Gerrit-Reviewer: Krinkle <krinklem...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to