Profiler/Fixup

* catch failing queries for characters, arena teams and guilds on realm
This commit is contained in:
Sarjuuk 2026-01-30 20:08:50 +01:00
parent dfabc9464d
commit a21feab939
3 changed files with 3 additions and 3 deletions

View file

@ -58,7 +58,7 @@ class ArenateamBaseResponse extends TemplateResponse
// 2) not yet synced but exists on realm (wont work if we get passed an urlized name, but there is nothing we can do about it)
$subjects = DB::Characters($this->realmId)->select('SELECT at.`arenaTeamId` AS "realmGUID", at.`name`, at.`type` FROM arena_team at WHERE at.`name` = ?', $this->subjectName);
if ($subject = array_filter($subjects, fn($x) => Util::lower($x['name']) === Util::lower($this->subjectName)))
if ($subject = array_filter($subjects ?: [], fn($x) => Util::lower($x['name']) === Util::lower($this->subjectName)))
{
$subject = array_pop($subject);
$subject['realm'] = $this->realmId;

View file

@ -58,7 +58,7 @@ class GuildBaseResponse extends TemplateResponse
// 2) not yet synced but exists on realm (wont work if we get passed an urlized name, but there is nothing we can do about it)
$subjects = DB::Characters($this->realmId)->select('SELECT `guildid` AS "realmGUID", `name` FROM guild WHERE `name` = ?', $this->subjectName);
if ($subject = array_filter($subjects, fn($x) => Util::lower($x['name']) === Util::lower($this->subjectName)))
if ($subject = array_filter($subjects ?: [], fn($x) => Util::lower($x['name']) === Util::lower($this->subjectName)))
{
$subject = array_pop($subject);
$subject['realm'] = $this->realmId;

View file

@ -90,7 +90,7 @@ class ProfileBaseResponse extends TemplateResponse
WHERE c.`name` = ? AND `level` <= ?d AND (`extra_flags` & ?d) = 0',
Util::ucFirst($this->subjectName), MAX_LEVEL, Profiler::CHAR_GMFLAGS
);
if ($subject = array_filter($subjects, fn($x) => Util::lower($x['name']) == Util::lower($this->subjectName)))
if ($subject = array_filter($subjects ?: [], fn($x) => Util::lower($x['name']) == Util::lower($this->subjectName)))
{
$subject = $subject[0];
$subject['realm'] = $this->realmId;