From e85c0626c157fb40ab96a0c0a1122ad3a7b122e1 Mon Sep 17 00:00:00 2001 From: Ben Banfield-Zanin Date: Thu, 24 Sep 2020 21:43:11 +0100 Subject: [PATCH] Don't move off legacy database form prematurely. Previously, any form submission would persist the database settings giving no chance to validate them or edit them. Toggling the MySQL enabled checkbox also triggered this as that reloaded the page. --- .../Controller/Install/Database.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Core/Frameworks/BaikalAdmin/Controller/Install/Database.php b/Core/Frameworks/BaikalAdmin/Controller/Install/Database.php index 2753a2a..d6d98d3 100644 --- a/Core/Frameworks/BaikalAdmin/Controller/Install/Database.php +++ b/Core/Frameworks/BaikalAdmin/Controller/Install/Database.php @@ -46,12 +46,6 @@ class Database extends \Flake\Core\Controller { $this->oModel->set('mysql_username', PROJECT_DB_MYSQL_USERNAME); $this->oModel->set('mysql_password', PROJECT_DB_MYSQL_PASSWORD); $this->oModel->set('encryption_key', BAIKAL_ENCRYPTION_KEY); - - if (defined("BAIKAL_CONFIGURED_VERSION")) { - $oStandardConfig = new \Baikal\Model\Config\Standard(); - $oStandardConfig->set("configured_version", BAIKAL_CONFIGURED_VERSION); - $oStandardConfig->persist(); - } } $this->oForm = $this->oModel->formForThisModelInstance([ @@ -68,6 +62,18 @@ class Database extends \Flake\Core\Controller { @unlink(PROJECT_PATH_SPECIFIC . "config.system.php"); } touch(PROJECT_PATH_SPECIFIC . '/INSTALL_DISABLED'); + + if (defined("BAIKAL_CONFIGURED_VERSION")) { + $oStandardConfig = new \Baikal\Model\Config\Standard(); + $oStandardConfig->set("configured_version", BAIKAL_CONFIGURED_VERSION); + $oStandardConfig->persist(); + + # We've just rolled back the configured version, so reload so that we get to the + # version upgrade page rather than the database is configured message in render below + $sLink = PROJECT_URI . "admin/install/?/database"; + \Flake\Util\Tools::redirect($sLink); + exit(0); + } } } }