User/Profiles

* speed up load of user profiles
This commit is contained in:
Sarjuuk
2025-11-05 18:16:30 +01:00
parent 16c5b73cd3
commit f44de66de7
2 changed files with 5 additions and 2 deletions

View File

@@ -780,7 +780,10 @@ class User
if (self::$profiles === null)
{
$conditions = [['OR', ['user', self::$id], ['ap.accountId', self::$id]]];
$ap = DB::Aowow()->selectCol('SELECT `profileId` FROM ?_account_profiles WHERE `accountId` = ?d', self::$id);
// the old approach ['OR', ['user', self::$id], ['ap.accountId', self::$id]] caused keys to not get used
$conditions = $ap ? [['OR', ['user', self::$id], ['id', array_keys($ap)]]] : ['user', self::$id];
if (!self::isInGroup(U_GROUP_ADMIN | U_GROUP_BUREAU))
$conditions[] = [['cuFlags', PROFILER_CU_DELETED, '&'], 0];