mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
User/Profiles
* speed up load of user profiles
This commit is contained in:
@@ -662,7 +662,7 @@ class LocalProfileList extends ProfileList
|
||||
protected string $queryBase = 'SELECT p.*, p.`id` AS ARRAY_KEY FROM ?_profiler_profiles p';
|
||||
protected array $queryOpts = array(
|
||||
'p' => [['g'], 'g' => 'p.`id`'],
|
||||
'ap' => ['j' => ['?_account_profiles ap ON ap.`profileId` = p.`id`', true], 's' => ', (IFNULL(ap.`ExtraFlags`, 0) | p.`cuFlags`) AS "cuFlags"'],
|
||||
'ap' => ['j' => ['?_account_profiles ap ON ap.`profileId` = p.`id`', true], 's' => ', (IFNULL(ap.`extraFlags`, 0) | p.`cuFlags`) AS "cuFlags"'],
|
||||
'atm' => ['j' => ['?_profiler_arena_team_member atm ON atm.`profileId` = p.`id`', true], 's' => ', atm.`captain`, atm.`personalRating` AS "rating", atm.`seasonGames`, atm.`seasonWins`'],
|
||||
'at' => [['atm'], 'j' => ['?_profiler_arena_team at ON at.`id` = atm.`arenaTeamId`', true], 's' => ', at.`type`'],
|
||||
'g' => ['j' => ['?_profiler_guild g ON g.`id` = p.`guild`', true], 's' => ', g.`name` AS "guildname"']
|
||||
|
||||
@@ -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];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user