From 4448e40302f14cfb428577f5f4066743bcf691f6 Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Willms <tleilax+studip@gmail.com> Date: Thu, 17 Oct 2024 13:11:25 +0000 Subject: [PATCH] add missing configurations for personal notifications, fixes #4711 Closes #4711 Merge request studip/studip!3504 --- ...d_personal_notification_configurations.php | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 db/migrations/5.3.24_add_personal_notification_configurations.php diff --git a/db/migrations/5.3.24_add_personal_notification_configurations.php b/db/migrations/5.3.24_add_personal_notification_configurations.php new file mode 100644 index 00000000000..b69756a95a0 --- /dev/null +++ b/db/migrations/5.3.24_add_personal_notification_configurations.php @@ -0,0 +1,38 @@ +<?php +final class AddPersonalNotificationConfigurations extends Migration +{ + public function description() + { + return 'Adds missing configurations for "PERSONAL_NOTIFICATIONS_DEACTIVATED" and "PERSONAL_NOTIFICATIONS_AUDIO_DEACTIVATED"'; + } + + protected function up() + { + $query = "INSERT IGNORE INTO `config` + (`field`, `value`, `type`, `range`, `mkdate`, `chdate`, `description`) + VALUES (:field, :value, 'boolean', 'user', UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), :description)"; + $statement = DBManager::get()->prepare($query); + + $statement->execute([ + ':field' => 'PERSONAL_NOTIFICATIONS_DEACTIVATED', + ':value' => '0', + ':description' => 'Deaktiviert die persönlichen Benachrichtigungen', + ]); + + $statement->execute([ + ':field' => 'PERSONAL_NOTIFICATIONS_AUDIO_DEACTIVATED', + ':value' => '0', + ':description' => 'Deaktiviert das Abspielen von Tönen für die persönlichen Benachrichtigungen', + ]); + } + + protected function down() + { + $query = "DELETE FROM `config` + WHERE `field` IN ( + 'PERSONAL_NOTIFICATIONS_DEACTIVATED', + 'PERSONAL_NOTIFICATIONS_AUDIO_DEACTIVATED' + )"; + DBManager::get()->execute($query); + } +} -- GitLab