diff --git a/Core/Distrib.php b/Core/Distrib.php index 18af561..125aeff 100644 --- a/Core/Distrib.php +++ b/Core/Distrib.php @@ -24,5 +24,5 @@ # This copyright notice MUST APPEAR in all copies of the script! ################################################################# -define("BAIKAL_VERSION", "0.6.0"); +define("BAIKAL_VERSION", "0.7.0"); define("BAIKAL_HOMEPAGE", "http://sabre.io/baikal/"); diff --git a/Core/Frameworks/BaikalAdmin/Controller/Install/Database.php b/Core/Frameworks/BaikalAdmin/Controller/Install/Database.php index 2ceadad..728a13c 100644 --- a/Core/Frameworks/BaikalAdmin/Controller/Install/Database.php +++ b/Core/Frameworks/BaikalAdmin/Controller/Install/Database.php @@ -38,6 +38,17 @@ class Database extends \Flake\Core\Controller { function execute() { $this->oModel = new \Baikal\Model\Config\System(PROJECT_PATH_CONFIG . "system.yaml"); + if (file_exists(PROJECT_PATH_SPECIFIC . "config.system.php")) { + require_once(PROJECT_PATH_SPECIFIC . "config.system.php"); + $this->oModel->set('PROJECT_SQLITE_FILE',PROJECT_SQLITE_FILE); + $this->oModel->set('PROJECT_DB_MYSQL',PROJECT_DB_MYSQL); + $this->oModel->set('PROJECT_DB_MYSQL_HOST',PROJECT_DB_MYSQL_HOST); + $this->oModel->set('PROJECT_DB_MYSQL_DBNAME',PROJECT_DB_MYSQL_DBNAME); + $this->oModel->set('PROJECT_DB_MYSQL_USERNAME',PROJECT_DB_MYSQL_USERNAME); + $this->oModel->set('PROJECT_DB_MYSQL_PASSWORD',PROJECT_DB_MYSQL_PASSWORD); + $this->oModel->set('BAIKAL_ENCRYPTION_KEY',BAIKAL_ENCRYPTION_KEY); + } + $this->oForm = $this->oModel->formForThisModelInstance([ "close" => false, "hook.validation" => [$this, "validateConnection"], @@ -48,6 +59,7 @@ class Database extends \Flake\Core\Controller { $this->oForm->execute(); if ($this->oForm->persisted()) { + unlink(PROJECT_PATH_SPECIFIC . "config.system.php"); touch(PROJECT_PATH_SPECIFIC . '/INSTALL_DISABLED'); } } diff --git a/Core/Frameworks/BaikalAdmin/Controller/Install/Initialize.php b/Core/Frameworks/BaikalAdmin/Controller/Install/Initialize.php index c639631..becc1ca 100644 --- a/Core/Frameworks/BaikalAdmin/Controller/Install/Initialize.php +++ b/Core/Frameworks/BaikalAdmin/Controller/Install/Initialize.php @@ -47,6 +47,16 @@ class Initialize extends \Flake\Core\Controller { $this->oModel = new \Baikal\Model\Config\Standard(PROJECT_PATH_CONFIG . "config.yaml"); + // If we come from pre-0.7.0, we need to get the values from the config.php and config.system.php files + if (file_exists(PROJECT_PATH_SPECIFIC . "config.php")) { + require_once(PROJECT_PATH_SPECIFIC . "config.php"); + $this->oModel->set('PROJECT_TIMEZONE', PROJECT_TIMEZONE); + $this->oModel->set('BAIKAL_CARD_ENABLED', BAIKAL_CARD_ENABLED); + $this->oModel->set('BAIKAL_CAL_ENABLED', BAIKAL_CAL_ENABLED); + $this->oModel->set('BAIKAL_INVITE_FROM', BAIKAL_INVITE_FROM); + $this->oModel->set('BAIKAL_DAV_AUTH_TYPE', BAIKAL_DAV_AUTH_TYPE); + } + $this->oForm = $this->oModel->formForThisModelInstance([ "close" => false ]); @@ -56,6 +66,14 @@ class Initialize extends \Flake\Core\Controller { if ($this->oForm->persisted()) { + // If we come from pre-0.7.0, we need to remove the INSTALL_DISABLED file so we go to the next step + if (file_exists(PROJECT_PATH_SPECIFIC . '/INSTALL_DISABLED')) { + unlink(PROJECT_PATH_SPECIFIC . '/INSTALL_DISABLED'); + } + if (file_exists(PROJECT_PATH_SPECIFIC . "config.php")) { + unlink(PROJECT_PATH_SPECIFIC . "config.php"); + } + # Creating system config, and initializing BAIKAL_ENCRYPTION_KEY $oSystemConfig = new \Baikal\Model\Config\System(PROJECT_PATH_CONFIG . "system.yaml"); $oSystemConfig->set("BAIKAL_ENCRYPTION_KEY", md5(microtime() . rand())); diff --git a/Core/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php b/Core/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php index 3669833..05920ea 100644 --- a/Core/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php +++ b/Core/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php @@ -525,24 +525,24 @@ SQL protected function updateConfiguredVersion($sVersionTo) { # Create new settings - $oConfig = new \Baikal\Model\Config\Standard(PROJECT_PATH_SPECIFIC . "config.php"); + $oConfig = new \Baikal\Model\Config\Standard(PROJECT_PATH_CONFIG . "config.yaml"); $oConfig->persist(); # Update BAIKAL_CONFIGURED_VERSION - $oConfig = new \Baikal\Model\Config\System(PROJECT_PATH_SPECIFIC . "config.system.php"); + $oConfig = new \Baikal\Model\Config\System(PROJECT_PATH_CONFIG . "system.yaml"); $oConfig->set("BAIKAL_CONFIGURED_VERSION", $sVersionTo); $oConfig->persist(); } protected function assertConfigWritable() { # Parsing the config also makes sure that it is not malformed - $oConfig = new \Baikal\Model\Config\Standard(PROJECT_PATH_SPECIFIC . "config.php"); + $oConfig = new \Baikal\Model\Config\Standard(PROJECT_PATH_CONFIG . "config.yaml"); if ($oConfig->writable() === false) { - throw new \Exception(PROJECT_PATH_SPECIFIC . "config.php is not writable"); + throw new \Exception(PROJECT_PATH_CONFIG . "config.yaml is not writable"); } - $oConfig = new \Baikal\Model\Config\System(PROJECT_PATH_SPECIFIC . "config.system.php"); + $oConfig = new \Baikal\Model\Config\System(PROJECT_PATH_CONFIG . "system.yaml"); if ($oConfig->writable() === false) { - throw new \Exception(PROJECT_PATH_SPECIFIC . "config.system.php is not writable"); + throw new \Exception(PROJECT_PATH_CONFIG . "system.yaml is not writable"); } } } diff --git a/config/system.yaml.dist b/config/system.yaml.dist index 36d7d0f..a03b7db 100644 --- a/config/system.yaml.dist +++ b/config/system.yaml.dist @@ -6,4 +6,4 @@ parameters: PROJECT_DB_MYSQL_USERNAME: 'baikal' PROJECT_DB_MYSQL_PASSWORD: 'baikal' BAIKAL_ENCRYPTION_KEY: '5d3f0fa0192e3058ea70f1bb20924add' - BAIKAL_CONFIGURED_VERSION: '0.6.0' \ No newline at end of file + BAIKAL_CONFIGURED_VERSION: '0.7.0' \ No newline at end of file