From 71ea5fa03d833d28d8290bed8348a5ccde487800 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Sun, 22 Mar 2020 17:33:13 +0100 Subject: [PATCH] Added missing migrations to a single config file --- .gitignore | 3 +++ Core/Frameworks/Baikal/Model/Calendar.php | 14 +++++++++++++- Core/Frameworks/Baikal/Model/Config/Standard.php | 2 +- html/card.php | 2 +- phpstan.neon | 3 --- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 8c7f057..0897e1f 100755 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,6 @@ vendor # Others .DS_Store + +# IDE +nbproject diff --git a/Core/Frameworks/Baikal/Model/Calendar.php b/Core/Frameworks/Baikal/Model/Calendar.php index 064c062..8ddca09 100644 --- a/Core/Frameworks/Baikal/Model/Calendar.php +++ b/Core/Frameworks/Baikal/Model/Calendar.php @@ -27,6 +27,8 @@ namespace Baikal\Model; +use Symfony\Component\Yaml\Yaml; + class Calendar extends \Flake\Core\Model\Db { const DATATABLE = "calendarinstances"; const PRIMARYKEY = "id"; @@ -39,11 +41,21 @@ class Calendar extends \Flake\Core\Model\Db { "description" => "", "calendarorder" => 0, "calendarcolor" => "", - "timezone" => PROJECT_TIMEZONE, + "timezone" => null, "calendarid" => 0 ]; protected $oCalendar; # Baikal\Model\Calendar\Calendar + function __construct($sPrimary = false) { + parent::__construct($sPrimary); + try { + $config = Yaml::parseFile(PROJECT_PATH_CONFIG . "baikal.yaml"); + $this->set("timezone", $config['system']["timezone"]); + } catch (\Exception $e) { + error_log('Error reading baikal.yaml file : ' . $e->getMessage()); + } + } + protected function initFloating() { parent::initFloating(); $this->oCalendar = new Calendar\Calendar(); diff --git a/Core/Frameworks/Baikal/Model/Config/Standard.php b/Core/Frameworks/Baikal/Model/Config/Standard.php index 65b79d3..a654630 100644 --- a/Core/Frameworks/Baikal/Model/Config/Standard.php +++ b/Core/Frameworks/Baikal/Model/Config/Standard.php @@ -124,7 +124,7 @@ class Standard extends \Baikal\Model\Config { error_log('Error reading baikal.yaml file : ' . $e->getMessage()); } - if (!isset($config['parameters']["admin_passwordhash"]) || trim($config['system']["admin_passwordhash"]) === "") { + if (!isset($config['system']["admin_passwordhash"]) || trim($config['system']["admin_passwordhash"]) === "") { # No password set (Form is used in install tool), so password is required as it has to be defined $oMorpho->element("admin_passwordhash")->setOption("validation", "required"); diff --git a/html/card.php b/html/card.php index 4c36852..a617214 100644 --- a/html/card.php +++ b/html/card.php @@ -60,7 +60,7 @@ try { die('

Incomplete installation

Baïkal is missing its configuration file, or its configuration file is unreadable.'); } -if (!isset($config['system']["card_enabled"]) || $config['parameters']["card_enabled"] !== true) { +if (!isset($config['system']["card_enabled"]) || $config['system']["card_enabled"] !== true) { throw new ErrorException("Baikal CardDAV is disabled.", 0, 255, __FILE__, __LINE__); } diff --git a/phpstan.neon b/phpstan.neon index 14a75c4..8adde37 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -8,9 +8,6 @@ parameters: - message: '#Instantiated class Flake\\Core\\Exception not found.#' path: Core/Frameworks/Flake/Util/Frameworks.php - - - message: '#Call to an undefined method Baikal\\Model\\Config\\Standard::getDefaultSystemConfig\(\).#' - path: Core/Frameworks/Baikal/Model/Config/Standard.php - message: '#Call to static method compileCss\(\) on an unknown class Frameworks\\LessPHP\\Delegate.#' path: Core/Frameworks/Flake/Controller/Page.php