X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fcache%2FUserCache.php;h=8f816d90139f1208471052a34b0b63f6e2dd2505;hb=64ef09d6a8cdbebdad9967aee0ee8c7be8e12739;hp=cb6857121e7c62514e5c41ab76b3b809dfb5dcfc;hpb=0ded00ab4c6dc1ad4e961412d357080a0a5a056d;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/cache/UserCache.php b/includes/cache/UserCache.php index cb6857121e..8f816d9013 100644 --- a/includes/cache/UserCache.php +++ b/includes/cache/UserCache.php @@ -56,9 +56,7 @@ class UserCache { $this->doQuery( [ $userId ] ); // cache miss } - return isset( $this->cache[$userId][$prop] ) - ? $this->cache[$userId][$prop] - : false; // user does not exist? + return $this->cache[$userId][$prop] ?? false; // user does not exist? } /** @@ -107,11 +105,13 @@ class UserCache { $fields = [ 'user_name', 'user_real_name', 'user_registration', 'user_id' ]; $joinConds = []; - if ( $wgActorTableSchemaMigrationStage > MIGRATION_OLD ) { + // Technically we shouldn't allow this without SCHEMA_COMPAT_READ_NEW, + // but it does little harm and might be needed for write callers loading a User. + if ( $wgActorTableSchemaMigrationStage & SCHEMA_COMPAT_NEW ) { $tables[] = 'actor'; $fields[] = 'actor_id'; $joinConds['actor'] = [ - $wgActorTableSchemaMigrationStage === MIGRATION_NEW ? 'JOIN' : 'LEFT JOIN', + ( $wgActorTableSchemaMigrationStage & SCHEMA_COMPAT_READ_NEW ) ? 'JOIN' : 'LEFT JOIN', [ 'actor_user = user_id' ] ]; } @@ -127,7 +127,7 @@ class UserCache { $this->cache[$userId]['name'] = $row->user_name; $this->cache[$userId]['real_name'] = $row->user_real_name; $this->cache[$userId]['registration'] = $row->user_registration; - if ( $wgActorTableSchemaMigrationStage > MIGRATION_OLD ) { + if ( $wgActorTableSchemaMigrationStage & SCHEMA_COMPAT_NEW ) { $this->cache[$userId]['actor'] = $row->actor_id; } $usersToCheck[$userId] = $row->user_name;