diff options
author | David M <davidmj@users.sourceforge.net> | 2007-05-25 17:42:32 +0000 |
---|---|---|
committer | David M <davidmj@users.sourceforge.net> | 2007-05-25 17:42:32 +0000 |
commit | a1ae65368ec9a9b8fefa456aaee568587cfe1021 (patch) | |
tree | b255a1bee156072b0e402ff18b61b1a237445647 /phpBB/includes/functions_admin.php | |
parent | 650f5a529cd47fa0c9b0cfc60c17f7375c4d7122 (diff) | |
download | forums-a1ae65368ec9a9b8fefa456aaee568587cfe1021.tar forums-a1ae65368ec9a9b8fefa456aaee568587cfe1021.tar.gz forums-a1ae65368ec9a9b8fefa456aaee568587cfe1021.tar.bz2 forums-a1ae65368ec9a9b8fefa456aaee568587cfe1021.tar.xz forums-a1ae65368ec9a9b8fefa456aaee568587cfe1021.zip |
we forgot to sync the forums that shadow topics reside in when the topic that they point to is deleted
git-svn-id: file:///svn/phpbb/trunk@7679 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_admin.php')
-rw-r--r-- | phpBB/includes/functions_admin.php | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 042e0bae03..3a24c5db1c 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -559,15 +559,33 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s } unset($table_ary); - $sql = 'DELETE FROM ' . TOPICS_TABLE . ' + $moved_topic_ids = array(); + + // update the other forums + $sql = 'SELECT topic_id, forum_id + FROM ' . TOPICS_TABLE . ' WHERE ' . $db->sql_in_set('topic_moved_id', $topic_ids); - $db->sql_query($sql); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $forum_ids[] = $row['forum_id']; + $moved_topic_ids[] = $row['topic_id']; + } + $db->sql_freeresult($result); + + if (sizeof($moved_topic_ids)) + { + $sql = 'DELETE FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $moved_topic_ids); + $db->sql_query($sql); + } $db->sql_transaction('commit'); if ($auto_sync) { - sync('forum', 'forum_id', $forum_ids, true, true); + sync('forum', 'forum_id', array_unique($forum_ids), true, true); sync('topic_reported', $where_type, $where_ids); } |