diff options
author | Tristan Darricau <github@nicofuma.fr> | 2014-05-27 01:35:52 +0200 |
---|---|---|
committer | Tristan Darricau <github@nicofuma.fr> | 2014-05-27 01:35:52 +0200 |
commit | d20d86bf108dc889451d0f1b294dc851c23b7018 (patch) | |
tree | bd5d348782796f331be9818a94970b76b3d8f4e8 /phpBB/includes/mcp/mcp_topic.php | |
parent | 49bc10de4d486b927adcf29d217d4169837f9a57 (diff) | |
download | forums-d20d86bf108dc889451d0f1b294dc851c23b7018.tar forums-d20d86bf108dc889451d0f1b294dc851c23b7018.tar.gz forums-d20d86bf108dc889451d0f1b294dc851c23b7018.tar.bz2 forums-d20d86bf108dc889451d0f1b294dc851c23b7018.tar.xz forums-d20d86bf108dc889451d0f1b294dc851c23b7018.zip |
[ticket/8610] Fix bookmarks when merging all the posts of a topic
PHPBB3-8610
Diffstat (limited to 'phpBB/includes/mcp/mcp_topic.php')
-rw-r--r-- | phpBB/includes/mcp/mcp_topic.php | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index 48efa330d4..c5c1bbd64d 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -588,14 +588,22 @@ function merge_posts($topic_id, $to_topic_id) return; } - $topic_data = get_topic_data(array($to_topic_id), 'm_merge'); + $sync_topics = array($topic_id, $to_topic_id); - if (!sizeof($topic_data)) + $topic_data = get_topic_data($sync_topics, 'm_merge'); + + if (!sizeof($topic_data) || empty($topic_data[$to_topic_id])) { $template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']); return; } + $sync_forums = array(); + foreach ($topic_data as $data) + { + $sync_forums[$data['forum_id']] = $data['forum_id']; + } + $topic_data = $topic_data[$to_topic_id]; $post_id_list = request_var('post_id_list', array(0)); @@ -630,7 +638,7 @@ function merge_posts($topic_id, $to_topic_id) { $to_forum_id = $topic_data['forum_id']; - move_posts($post_id_list, $to_topic_id); + move_posts($post_id_list, $to_topic_id, false); add_log('mod', $to_forum_id, $to_topic_id, 'LOG_MERGE', $topic_data['topic_title']); // Message and return links @@ -638,7 +646,7 @@ function merge_posts($topic_id, $to_topic_id) // Does the original topic still exist? If yes, link back to it $sql = 'SELECT forum_id - FROM ' . TOPICS_TABLE . ' + FROM ' . POSTS_TABLE . ' WHERE topic_id = ' . $topic_id; $result = $db->sql_query_limit($sql, 1); $row = $db->sql_fetchrow($result); @@ -662,6 +670,12 @@ function merge_posts($topic_id, $to_topic_id) phpbb_update_rows_avoiding_duplicates($db, BOOKMARKS_TABLE, 'topic_id', array($topic_id), $to_topic_id); } + // Re-sync the topics and forums because the auto-sync was deactivated in the call of move_posts() + sync('topic_reported', 'topic_id', $sync_topics); + sync('topic_attachment', 'topic_id', $sync_topics); + sync('topic', 'topic_id', $sync_topics, true); + sync('forum', 'forum_id', $sync_forums, true, true); + // Link to the new topic $return_link .= (($return_link) ? '<br /><br />' : '') . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $to_forum_id . '&t=' . $to_topic_id) . '">', '</a>'); $redirect = request_var('redirect', "{$phpbb_root_path}viewtopic.$phpEx?f=$to_forum_id&t=$to_topic_id"); |