From ea09c9ff4bf4e6bcd196ef41d0c960a7ff974f68 Mon Sep 17 00:00:00 2001 From: blackcoder87 Date: Thu, 28 Sep 2023 20:11:37 +0200 Subject: [PATCH] away: fix adding calendar_events entry (#788) --- application/modules/away/config/config.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/application/modules/away/config/config.php b/application/modules/away/config/config.php index 61ba4f623..1d75fb8c1 100644 --- a/application/modules/away/config/config.php +++ b/application/modules/away/config/config.php @@ -10,7 +10,7 @@ class Config extends \Ilch\Config\Install { public $config = [ 'key' => 'away', - 'version' => '1.6.0', + 'version' => '1.6.1', 'icon_small' => 'fa-solid fa-calendar-xmark', 'author' => 'Veldscholten, Kevin', 'link' => 'https://ilch.de', @@ -71,7 +71,7 @@ public function getInstallSql() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;'; if ($this->db()->ifTableExists('[prefix]_calendar_events')) { - $installSql.'INSERT INTO `[prefix]_calendar_events` (`url`) VALUES ("away/aways/index/");'; + $installSql .= 'INSERT INTO `[prefix]_calendar_events` (`url`) VALUES ("away/aways/index/");'; } return $installSql; @@ -104,6 +104,12 @@ public function getUpdate($installedVersion) $databaseConfig->set('away_adminNotification', 1); case "1.5.0": $this->db()->query("UPDATE `[prefix]_modules` SET `icon_small` = 'fa-solid fa-calendar-xmark' WHERE `key` = 'away';"); + case "1.6.0": + if ($this->db()->ifTableExists('[prefix]_calendar_events')) { + if (!$this->db()->select('url', 'calendar_events', ['url' => 'away/aways/index/'])->execute()->getNumRows()) { + $this->db()->query("INSERT INTO `[prefix]_calendar_events` (`url`) VALUES ('away/aways/index/');"); + } + } } } }