Merge "Update cached user ID after user is added to the database"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 20 Nov 2015 19:00:10 +0000 (19:00 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 20 Nov 2015 19:00:10 +0000 (19:00 +0000)
includes/User.php

index b09e4e4..611f603 100644 (file)
@@ -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();