From 981c2963565899b3a2e10a147641edfc66807192 Mon Sep 17 00:00:00 2001 From: Mark Unwin Date: Tue, 5 Dec 2023 13:50:54 +1000 Subject: [PATCH] Fix DB Upgrade to 5.0.2. --- app/Controllers/Database.php | 6 +++++- app/Models/db_upgrades/db_5.0.2.php | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/Controllers/Database.php b/app/Controllers/Database.php index 82cc602ff..e816d2634 100644 --- a/app/Controllers/Database.php +++ b/app/Controllers/Database.php @@ -248,7 +248,11 @@ public function update($action) $output = $this->databaseModel->update(); $sql = "SELECT * FROM configuration WHERE `name` = 'license_eula'"; $db = db_connect(); - $eula = $db->query($sql)->getResult()[0]; + $eula = new \stdClass(); + $test = $db->query($sql)->getResult(); + if (!empty($test[0])) { + $elua = $test[0]; + } $item = new \stdClass(); if (!empty($eula->value) and $eula->value !== '') { $item = json_decode($eula->value); diff --git a/app/Models/db_upgrades/db_5.0.2.php b/app/Models/db_upgrades/db_5.0.2.php index 3586c77cb..589718ced 100644 --- a/app/Models/db_upgrades/db_5.0.2.php +++ b/app/Models/db_upgrades/db_5.0.2.php @@ -2,7 +2,7 @@ $output .= "Upgrade database to 5.0.2 commenced.\n\n"; // set our versions -$sql = "UPDATE `configuration` SET `value` = '20231130' WHERE `name` = 'internal_version'"; +$sql = "UPDATE `configuration` SET `value` = '20231207' WHERE `name` = 'internal_version'"; $db->query($sql); $output .= str_replace("\n", " ", (string)$db->getLastQuery()) . "\n\n"; log_message('info', (string)$db->getLastQuery()); @@ -13,5 +13,5 @@ log_message('info', (string)$db->getLastQuery()); $output .= "Upgrade database to 5.0.2 completed.\n\n"; -config('Openaudit')->internal_version = 20231130; +config('Openaudit')->internal_version = 20231207; config('Openaudit')->display_version = '5.0.2';