UserPage/Optimization

* split up fetching of custom profiles and characters to make use of existing keys
This commit is contained in:
Sarjuuk
2025-11-08 22:48:18 +01:00
parent fa89a5ad1e
commit 0d42d2a2c4

View File

@@ -233,30 +233,33 @@ class UserBaseResponse extends TemplateResponse
if (Cfg::get('PROFILER_ENABLE')) if (Cfg::get('PROFILER_ENABLE'))
{ {
$conditions = array( $conditions = [['user', $this->user['id']]];
['OR', ['cuFlags', PROFILER_CU_PUBLISHED, '&'], ['ap.extraFlags', PROFILER_CU_PUBLISHED, '&']], if (User::$id != $this->user['id'] && !User::isInGroup(U_GROUP_ADMIN | U_GROUP_BUREAU))
['deleted', 0], $conditions[] = ['cuFlags', PROFILER_CU_PUBLISHED, '&'];
['OR', ['user', $this->user['id']], ['ap.accountId', $this->user['id']]] if (!User::isInGroup(U_GROUP_ADMIN | U_GROUP_BUREAU))
); $conditions[] = ['deleted', 0];
if (User::isInGroup(U_GROUP_ADMIN | U_GROUP_BUREAU))
$conditions = array_slice($conditions, 2);
else if (User::$id == $this->user['id'])
array_shift($conditions);
$profiles = new LocalProfileList($conditions); $profiles = new LocalProfileList($conditions);
if (!$profiles->error) if (!$profiles->error)
{ {
$this->addDataLoader('weight-presets'); $this->addDataLoader('weight-presets');
// Characters
if ($chars = $profiles->getListviewData(PROFILEINFO_CHARACTER | PROFILEINFO_USER))
$this->charactersLvData = array_values($chars);
// Profiles
if ($prof = $profiles->getListviewData(PROFILEINFO_PROFILE | PROFILEINFO_USER)) if ($prof = $profiles->getListviewData(PROFILEINFO_PROFILE | PROFILEINFO_USER))
$this->profilesLvData = array_values($prof); $this->profilesLvData = array_values($prof);
} }
$conditions = [['ap.accountId', $this->user['id']]];
if (User::$id != $this->user['id'] && !User::isInGroup(U_GROUP_ADMIN | U_GROUP_BUREAU))
$conditions[] = ['ap.extraFlags', PROFILER_CU_PUBLISHED, '&'];
$characters = new LocalProfileList($conditions);
if (!$characters->error)
{
$this->addDataLoader('weight-presets');
if ($chars = $characters->getListviewData(PROFILEINFO_CHARACTER | PROFILEINFO_USER))
$this->charactersLvData = array_values($chars);
}
} }
// My Guides // My Guides