Avoid user autocreation race condition caused by repeatable read
authorGergő Tisza <gtisza@wikimedia.org>
Thu, 8 Sep 2016 22:40:20 +0000 (22:40 +0000)
committerAaron Schulz <aschulz@wikimedia.org>
Fri, 9 Sep 2016 00:14:15 +0000 (17:14 -0700)
commit55572b08a6845e892870abcac4b8b0718b7c9075
tree13059baf48770b256d961948f0e77a32d591326d
parentb2585a95b27fc196bcded4c146d1251d9d7740b9
Avoid user autocreation race condition caused by repeatable read

AuthManager tries to check whether the user already exists if
User::addToDatabase fails in autocreation, but since the same DB row
was already checked a few lines earlier and this method is typically
wrapped in an implicit transaction, it will just re-read the same
snapshot and not do anything useful. addToDatabase already has
a check for that so let's rely on that instead.

Bug: T145131
Change-Id: I94a5e8b851dcf994f5f9e773edf4e9153a4a3535
includes/auth/AuthManager.php
tests/phpunit/includes/auth/AuthManagerTest.php