diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2023-03-22 16:04:54 +0000 |
|---|---|---|
| committer | Elmar Ludwig <elmar.ludwig@uni-osnabrueck.de> | 2023-03-22 16:04:54 +0000 |
| commit | d205fc6aaee6d3d8173efb15c8d364f410a02a41 (patch) | |
| tree | 96b042380f9c9776bbb52c9cba38942d9a7842a5 /db | |
| parent | cf947d0af7b3edba8f8d3b8f4a5674928d037fb3 (diff) | |
remove obsolete old configuration entries, fixes #2423
Closes #2423
Merge request studip/studip!1618
Diffstat (limited to 'db')
| -rw-r--r-- | db/migrations/1.271_room_management_migration.php | 32 | ||||
| -rw-r--r-- | db/migrations/5.1.44_cleanup_old_resource_configurations.php | 40 |
2 files changed, 40 insertions, 32 deletions
diff --git a/db/migrations/1.271_room_management_migration.php b/db/migrations/1.271_room_management_migration.php index 8edb190..725360d 100644 --- a/db/migrations/1.271_room_management_migration.php +++ b/db/migrations/1.271_room_management_migration.php @@ -1106,38 +1106,6 @@ class RoomManagementMigration extends Migration ); } - - public function removeObsoleteConfigEntries(PDO $db) - { - $entries = [ - 'RESOURCES_ALLOW_CREATE_ROOMS', - 'RESOURCES_ALLOW_CREATE_TOP_LEVEL', - 'RESOURCES_ALLOW_DELETE_REQUESTS', - 'RESOURCES_ALLOW_REQUESTABLE_ROOM_REQUESTS', - 'RESOURCES_ALLOW_ROOM_REQUESTS_ALL_ROOMS', - 'RESOURCES_ENABLE_GROUPING', - 'RESOURCES_ENABLE_ORGA_CLASSIFY', - 'RESOURCES_ENABLE_SEM_SCHEDULE', - 'RESOURCES_ENABLE_VIRTUAL_ROOM_GROUPS', - 'RESOURCES_HIDE_PAST_SINGLE_DATES', - 'RESOURCES_INHERITANCE_PERMS', - 'RESOURCES_INHERITANCE_PERMS_ROOMS', - 'RESOURCES_LOCKING_ACTIVE', - 'RESOURCES_ROOM_REQUEST_DEFAULT_ACTION', - 'RESOURCES_SCHEDULE_EXPLAIN_USER_NAME', - 'RESOURCES_SEARCH_ONLY_REQUESTABLE_PROPERTY', - 'RESOURCES_SHOW_ROOM_NOT_BOOKED_HINT', - 'RESOURCES_ENABLE_ORGA_ADMIN_NOTICE' - ]; - - $stmt = $db->prepare( - 'DELETE FROM config WHERE field IN ( :entries );' - ); - - $stmt->execute(['entries' => $entries]); - } - - public function createPropertyGroups(PDO $db) { $get_group_id_stmt = $db->prepare( diff --git a/db/migrations/5.1.44_cleanup_old_resource_configurations.php b/db/migrations/5.1.44_cleanup_old_resource_configurations.php new file mode 100644 index 0000000..1a12cf3 --- /dev/null +++ b/db/migrations/5.1.44_cleanup_old_resource_configurations.php @@ -0,0 +1,40 @@ +<?php + +/** + * @see https://gitlab.studip.de/studip/studip/-/issues/2423 + */ +final class CleanupOldResourceConfigurations extends Migration +{ + public function description() + { + return 'Removes obsolete configuration entries from old resource management'; + } + + protected function up() + { + $query = "DELETE `config`, `config_values` + FROM `config` + LEFT JOIN `config_values` USING (`field`) + WHERE `field` IN ( + 'RESOURCES_ALLOW_CREATE_ROOMS', + 'RESOURCES_ALLOW_CREATE_TOP_LEVEL', + 'RESOURCES_ALLOW_DELETE_REQUESTS', + 'RESOURCES_ALLOW_REQUESTABLE_ROOM_REQUESTS', + 'RESOURCES_ALLOW_ROOM_REQUESTS_ALL_ROOMS', + 'RESOURCES_ENABLE_GROUPING', + 'RESOURCES_ENABLE_ORGA_CLASSIFY', + 'RESOURCES_ENABLE_SEM_SCHEDULE', + 'RESOURCES_ENABLE_VIRTUAL_ROOM_GROUPS', + 'RESOURCES_HIDE_PAST_SINGLE_DATES', + 'RESOURCES_INHERITANCE_PERMS', + 'RESOURCES_INHERITANCE_PERMS_ROOMS', + 'RESOURCES_LOCKING_ACTIVE', + 'RESOURCES_ROOM_REQUEST_DEFAULT_ACTION', + 'RESOURCES_SCHEDULE_EXPLAIN_USER_NAME', + 'RESOURCES_SEARCH_ONLY_REQUESTABLE_PROPERTY', + 'RESOURCES_SHOW_ROOM_NOT_BOOKED_HINT', + 'RESOURCES_ENABLE_ORGA_ADMIN_NOTICE' + )"; + DBManager::get()->exec($query); + } +} |
