From a92428287d639104b091663e6f42936f834ea0ba Mon Sep 17 00:00:00 2001 From: slawkens Date: Sat, 31 Jan 2026 12:12:32 +0100 Subject: [PATCH] Migration: 49 - Fix get proper account id for samples --- system/migrations/49.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/system/migrations/49.php b/system/migrations/49.php index fc78ac27..6769c715 100644 --- a/system/migrations/49.php +++ b/system/migrations/49.php @@ -3,11 +3,21 @@ * @var OTS_DB_MySQL $db */ +use MyAAC\Models\Account as AccountModel; + $time = time(); +$accountId = getSession('account') ?? 1; +if (!defined('MYAAC_INSTALL')) { + $accountModel = AccountModel::where('web_flags', 3)->first(); + if ($accountModel) { + $accountId = $accountModel->id; + } +} + function insert_sample_if_not_exist($p): void { - global $time; + global $time, $accountId; $player = new OTS_Player(); $player->find($p['name']); @@ -17,7 +27,7 @@ function insert_sample_if_not_exist($p): void $player->setData([ 'name' => $p['name'], 'group_id' => 1, - 'account_id' => getSession('account') ?? 1, + 'account_id' => $accountId, 'level' => $p['level'], 'vocation' => $p['vocation_id'], 'health' => $p['health'],