Skip to content
Snippets Groups Projects
Commit 826abb03 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms Committed by Jan-Hendrik Willms
Browse files

remove forum abos and favorites upon user deletion and add a migration that...

remove forum abos and favorites upon user deletion and add a migration that cleans up the current state in the tables, fixes #2289

Closes #2289

Merge request studip/studip!1513
parent 63ea2839
No related branches found
No related tags found
No related merge requests found
<?php
final class CleanupForumTables extends Migration
{
protected function up()
{
$query = "DELETE FROM `forum_abo_users`
WHERE `user_id` NOT IN (
SELECT `user_id`
FROM `auth_user_md5`
)";
DBManager::get()->exec($query);
$query = "DELETE FROM `forum_favorites`
WHERE `user_id` NOT IN (
SELECT `user_id`
FROM `auth_user_md5`
)";
DBManager::get()->exec($query);
}
}
......@@ -1181,6 +1181,8 @@ class UserManagement
"DELETE FROM evalanswer_user WHERE user_id = ?",
"DELETE FROM help_tour_user WHERE user_id = ?",
"DELETE FROM personal_notifications_user WHERE user_id = ?",
"DELETE FROM forum_abo_users WHERE user_id = ?",
"DELETE FROM forum_favorites WHERE user_id = ?",
"DELETE FROM comments WHERE user_id = ?",
"DELETE questionnaires FROM questionnaires LEFT JOIN questionnaire_assignments qa USING (`questionnaire_id`) WHERE qa.range_id = ?",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment