Profiler/Sync

* fix SQL FK error when creating guild or arenateam stub.
 * Urlized name field is non-optional
This commit is contained in:
Sarjuuk 2025-10-10 18:05:12 +02:00
parent 5d2fd00358
commit 204d4b8ae2
3 changed files with 4 additions and 2 deletions

View file

@ -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));

View file

@ -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));

View file

@ -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']);