diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2024-05-06 09:03:33 +0000 |
|---|---|---|
| committer | David Siegfried <david.siegfried@uni-vechta.de> | 2024-05-06 09:03:33 +0000 |
| commit | e7bfc2e80046cdbe28122c8430d9ce9dfdafb5a1 (patch) | |
| tree | ddb6021c7983c38418fd9bf8d455628b89e98759 /db | |
| parent | 8474ee1063d11f1d5fd4b79674d2d734b82e18b0 (diff) | |
fixes #3977
Closes #3977
Merge request studip/studip!2945
Diffstat (limited to 'db')
| -rw-r--r-- | db/migrations/5.1.57_cleanup_tool_activations.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/db/migrations/5.1.57_cleanup_tool_activations.php b/db/migrations/5.1.57_cleanup_tool_activations.php new file mode 100644 index 0000000..6700816 --- /dev/null +++ b/db/migrations/5.1.57_cleanup_tool_activations.php @@ -0,0 +1,23 @@ +<?php +/** + * @see https://gitlab.studip.de/studip/studip/-/issues/3977 + */ +return new class extends Migration +{ + public function description() + { + return 'Removes invalid tool activations (that are no longer connected ' + . 'to a StandardPlugin'; + } + + protected function up() + { + $query = "DELETE FROM `tools_activated` + WHERE `plugin_id` NOT IN ( + SELECT `pluginid` + FROM `plugins` + WHERE FIND_IN_SET(?, `plugintype`) + )"; + DBManager::get()->execute($query, [StandardPlugin::class]); + } +}; |
