diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2025-08-20 09:43:04 +0200 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2025-08-20 09:43:04 +0200 |
| commit | b204259dd9b1cd48a7f445c473c3687914f6b209 (patch) | |
| tree | 45339c84e4f6b45daad0fdc6fdfdbe5a6b08e60b | |
| parent | 9b00fe9beff89cf4d61ad050bd343c134e182ec7 (diff) | |
fix deleting of wiki pages when deleting an institute, fixes #5826
Closes #5826
Merge request studip/studip!4442
| -rw-r--r-- | app/controllers/institute/basicdata.php | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/app/controllers/institute/basicdata.php b/app/controllers/institute/basicdata.php index c1bb1cd..b18afd9 100644 --- a/app/controllers/institute/basicdata.php +++ b/app/controllers/institute/basicdata.php @@ -414,12 +414,15 @@ class Institute_BasicdataController extends AuthenticatedController //kill all wiki-pages $removed_wiki_pages = 0; - foreach (['', '_links', '_locks'] as $area) { - $query = "DELETE FROM wiki{$area} WHERE range_id = ?"; - $statement = DBManager::get()->prepare($query); - $statement->execute([$i_id]); - $removed_wiki_pages += $statement->rowCount(); - } + WikiPage::findEachBySQL( + function (WikiPage $page) use (&$removed_wiki_pages) { + if ($page->delete()) { + $removed_wiki_pages += 1; + } + }, + 'range_id = ?', + [$i_id] + ); if ($removed_wiki_pages > 0) { $details[] = sprintf(_('%u Wikiseiten gelöscht.')); } |
