From 7bdb66ec5f26fdf471bff363fdf0b60e6bc68b74 Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Willms Date: Mon, 21 Aug 2023 13:37:44 +0000 Subject: rename migration, fixes #3036 Closes #3036 Merge request studip/studip!2034 --- .../5.4.12_add_missing_lock_log_actions.php | 52 ++++++++++++++++++++++ db/migrations/5.4.12_add_missing_log_actions.php | 52 ---------------------- 2 files changed, 52 insertions(+), 52 deletions(-) create mode 100644 db/migrations/5.4.12_add_missing_lock_log_actions.php delete mode 100644 db/migrations/5.4.12_add_missing_log_actions.php diff --git a/db/migrations/5.4.12_add_missing_lock_log_actions.php b/db/migrations/5.4.12_add_missing_lock_log_actions.php new file mode 100644 index 0000000..50be4da --- /dev/null +++ b/db/migrations/5.4.12_add_missing_lock_log_actions.php @@ -0,0 +1,52 @@ +exec(" + INSERT IGNORE INTO `log_actions` + SET `action_id` = MD5('USER_LOCK'), + `name` = 'USER_LOCK', + `description` = 'Nutzer wird gesperrt', + `info_template` = '%user sperrt %user(%affected) (%info)', + `active` = '1', + `expires` = '0' + "); + + DBManager::get()->exec(" + INSERT IGNORE INTO `log_actions` + SET `action_id` = MD5('FILE_DELETE'), + `name` = 'FILE_DELETE', + `description` = 'Nutzer löscht Datei', + `info_template` = '%user löscht Datei %info (File-Id: %affected)', + `active` = '1', + `expires` = '0' + "); + DBManager::get()->exec(" + INSERT IGNORE INTO `log_actions` + SET `action_id` = MD5('FOLDER_DELETE'), + `name` = 'FOLDER_DELETE', + `description` = 'Nutzer löscht Ordner', + `info_template` = '%user löscht Datei %info (Folder-Id: %affected)', + `active` = '1', + `expires` = '0' + "); + } + + public function down() + { + $actions = ['USER_LOCK', 'FILE_DELETE', 'FOLDER_DELETE']; + + DBManager::get()->execute( + "DELETE `log_events` FROM `log_events` JOIN `log_actions` USING (`action_id`) WHERE `name` IN (?)", + [$actions] + ); + DBManager::get()->execute("DELETE FROM `log_actions` WHERE `name` IN (?)", [$actions]); + } +} diff --git a/db/migrations/5.4.12_add_missing_log_actions.php b/db/migrations/5.4.12_add_missing_log_actions.php deleted file mode 100644 index 0a82199..0000000 --- a/db/migrations/5.4.12_add_missing_log_actions.php +++ /dev/null @@ -1,52 +0,0 @@ -exec(" - INSERT IGNORE INTO `log_actions` - SET `action_id` = MD5('USER_LOCK'), - `name` = 'USER_LOCK', - `description` = 'Nutzer wird gesperrt', - `info_template` = '%user sperrt %user(%affected) (%info)', - `active` = '1', - `expires` = '0' - "); - - DBManager::get()->exec(" - INSERT IGNORE INTO `log_actions` - SET `action_id` = MD5('FILE_DELETE'), - `name` = 'FILE_DELETE', - `description` = 'Nutzer löscht Datei', - `info_template` = '%user löscht Datei %info (File-Id: %affected)', - `active` = '1', - `expires` = '0' - "); - DBManager::get()->exec(" - INSERT IGNORE INTO `log_actions` - SET `action_id` = MD5('FOLDER_DELETE'), - `name` = 'FOLDER_DELETE', - `description` = 'Nutzer löscht Ordner', - `info_template` = '%user löscht Datei %info (Folder-Id: %affected)', - `active` = '1', - `expires` = '0' - "); - } - - public function down() - { - $actions = ['USER_LOCK', 'FILE_DELETE', 'FOLDER_DELETE']; - - DBManager::get()->execute( - "DELETE `log_events` FROM `log_events` JOIN `log_actions` USING (`action_id`) WHERE `name` IN (?)", - [$actions] - ); - DBManager::get()->execute("DELETE FROM `log_actions` WHERE `name` IN (?)", [$actions]); - } -} -- cgit v1.0