mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
UserPage/Optimization
* split up fetching of custom profiles and characters to make use of existing keys
This commit is contained in:
@@ -233,30 +233,33 @@ class UserBaseResponse extends TemplateResponse
|
||||
|
||||
if (Cfg::get('PROFILER_ENABLE'))
|
||||
{
|
||||
$conditions = array(
|
||||
['OR', ['cuFlags', PROFILER_CU_PUBLISHED, '&'], ['ap.extraFlags', PROFILER_CU_PUBLISHED, '&']],
|
||||
['deleted', 0],
|
||||
['OR', ['user', $this->user['id']], ['ap.accountId', $this->user['id']]]
|
||||
);
|
||||
|
||||
if (User::isInGroup(U_GROUP_ADMIN | U_GROUP_BUREAU))
|
||||
$conditions = array_slice($conditions, 2);
|
||||
else if (User::$id == $this->user['id'])
|
||||
array_shift($conditions);
|
||||
$conditions = [['user', $this->user['id']]];
|
||||
if (User::$id != $this->user['id'] && !User::isInGroup(U_GROUP_ADMIN | U_GROUP_BUREAU))
|
||||
$conditions[] = ['cuFlags', PROFILER_CU_PUBLISHED, '&'];
|
||||
if (!User::isInGroup(U_GROUP_ADMIN | U_GROUP_BUREAU))
|
||||
$conditions[] = ['deleted', 0];
|
||||
|
||||
$profiles = new LocalProfileList($conditions);
|
||||
if (!$profiles->error)
|
||||
{
|
||||
$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))
|
||||
$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
|
||||
|
||||
Reference in New Issue
Block a user