Use DB_SLAVE in TemporaryPasswordPrimaryAuthenticationProvider
authorAaron Schulz <aschulz@wikimedia.org>
Sun, 28 Aug 2016 19:10:14 +0000 (12:10 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Mon, 29 Aug 2016 15:53:37 +0000 (15:53 +0000)
Barring ChronologyProtector failure (which itself falls back
to waitForReplication) on account creation, this should be fine.

Change-Id: I94be86c8f56e9e98a9d06814b33a9f08a9228db6

includes/auth/TemporaryPasswordPrimaryAuthenticationProvider.php

index ed94c1a..c338284 100644 (file)
@@ -126,8 +126,8 @@ class TemporaryPasswordPrimaryAuthenticationProvider
                        return AuthenticationResponse::newAbstain();
                }
 
-               $dbw = wfGetDB( DB_MASTER );
-               $row = $dbw->selectRow(
+               $dbr = wfGetDB( DB_SLAVE );
+               $row = $dbr->selectRow(
                        'user',
                        [
                                'user_id', 'user_newpassword', 'user_newpass_time',
@@ -165,8 +165,8 @@ class TemporaryPasswordPrimaryAuthenticationProvider
                        return false;
                }
 
-               $dbw = wfGetDB( DB_MASTER );
-               $row = $dbw->selectRow(
+               $dbr = wfGetDB( DB_SLAVE );
+               $row = $dbr->selectRow(
                        'user',
                        [ 'user_newpassword', 'user_newpass_time' ],
                        [ 'user_name' => $username ],