Merge "Localisation updates from https://translatewiki.net."
[lhc/web/wiklou.git] / includes / User.php
index b09e4e4..3d1aa7e 100644 (file)
@@ -699,7 +699,7 @@ class User implements IDBAccessObject {
                        return null;
                }
 
-               if ( isset( self::$idCacheByName[$name] ) ) {
+               if ( !( $flags & self::READ_LATEST ) && isset( self::$idCacheByName[$name] ) ) {
                        return self::$idCacheByName[$name];
                }
 
@@ -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();