From: Gergő Tisza Date: Thu, 19 Nov 2015 00:42:39 +0000 (-0800) Subject: Update cached user ID after user is added to the database X-Git-Tag: 1.31.0-rc.0~8930^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=780c368b5e4231daffd415ce8911c2c0fb56b70f Update cached user ID after user is added to the database Bug: T119021 Change-Id: I5e0599d1d045b0389a7825fddc2b346e4cfd001d --- diff --git a/includes/User.php b/includes/User.php index b09e4e456e..611f603270 100644 --- a/includes/User.php +++ b/includes/User.php @@ -2423,7 +2423,7 @@ class User implements IDBAccessObject { * through the web interface. */ private function setPasswordInternal( $str ) { - $id = self::idFromName( $this->getName() ); + $id = self::idFromName( $this->getName(), self::READ_LATEST ); if ( $id == 0 ) { throw new LogicException( 'Cannot set a password for a user that is not in the database.' ); } @@ -3898,6 +3898,7 @@ class User implements IDBAccessObject { return Status::newFatal( 'userexists' ); } $this->mId = $dbw->insertId(); + self::$idCacheByName[$this->mName] = $this->mId; // Clear instance cache other than user table data, which is already accurate $this->clearInstanceCache();