From 204d4b8ae2462dca187dc78604e7755844ce2fc8 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Fri, 10 Oct 2025 18:05:12 +0200 Subject: [PATCH] Profiler/Sync * fix SQL FK error when creating guild or arenateam stub. * Urlized name field is non-optional --- endpoints/arena-team/arena-team.php | 1 + endpoints/guild/guild.php | 1 + endpoints/profile/profile.php | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/endpoints/arena-team/arena-team.php b/endpoints/arena-team/arena-team.php index 2d40ce97..2ade7851 100644 --- a/endpoints/arena-team/arena-team.php +++ b/endpoints/arena-team/arena-team.php @@ -61,6 +61,7 @@ class ArenateamBaseResponse extends TemplateResponse { $subject['realm'] = $this->realmId; $subject['cuFlags'] = PROFILER_CU_NEEDS_RESYNC; + $subject['nameUrl'] = Profiler::urlize($subject['name']); // create entry from realm with basic info DB::Aowow()->query('INSERT IGNORE INTO ?_profiler_arena_team (?#) VALUES (?a)', array_keys($subject), array_values($subject)); diff --git a/endpoints/guild/guild.php b/endpoints/guild/guild.php index 8855b26c..f4ec2335 100644 --- a/endpoints/guild/guild.php +++ b/endpoints/guild/guild.php @@ -61,6 +61,7 @@ class GuildBaseResponse extends TemplateResponse { $subject['realm'] = $this->realmId; $subject['cuFlags'] = PROFILER_CU_NEEDS_RESYNC; + $subject['nameUrl'] = Profiler::urlize($subject['name']); // create entry from realm with basic info DB::Aowow()->query('INSERT IGNORE INTO ?_profiler_guild (?#) VALUES (?a)', array_keys($subject), array_values($subject)); diff --git a/endpoints/profile/profile.php b/endpoints/profile/profile.php index 2e41350c..958ffaae 100644 --- a/endpoints/profile/profile.php +++ b/endpoints/profile/profile.php @@ -99,10 +99,10 @@ class ProfileBaseResponse extends TemplateResponse if ($subject['guildGUID']) { - // create empty guild if nessecary to satisfy foreign keys + // create empty guild if necessary to satisfy foreign keys $subject['guild'] = DB::Aowow()->selectCell('SELECT `id` FROM ?_profiler_guild WHERE `realm` = ?d AND `realmGUID` = ?d', $this->realmId, $subject['guildGUID']); if (!$subject['guild']) - $subject['guild'] = DB::Aowow()->query('INSERT INTO ?_profiler_guild (`realm`, `realmGUID`, `cuFlags`, `name`) VALUES (?d, ?d, ?d, ?)', $this->realmId, $subject['guildGUID'], PROFILER_CU_NEEDS_RESYNC, $subject['guildName']); + $subject['guild'] = DB::Aowow()->query('INSERT INTO ?_profiler_guild (`realm`, `realmGUID`, `cuFlags`, `name`, `nameUrl`) VALUES (?d, ?d, ?d, ?, ?)', $this->realmId, $subject['guildGUID'], PROFILER_CU_NEEDS_RESYNC, $subject['guildName'], Profiler::urlize($subject['guildName'])); } unset($subject['guildGUID'], $subject['guildName'], $subject['at_login']);