diff options
author | Nathan Guse <nathaniel.guse@gmail.com> | 2012-12-13 20:42:10 -0600 |
---|---|---|
committer | Nathan Guse <nathaniel.guse@gmail.com> | 2012-12-13 20:42:10 -0600 |
commit | a50907250e487675baf9ac77be564b6ccb72b056 (patch) | |
tree | 7b8cb763fa99a8a14cf58a5a5d79e8f7ffd8c923 /phpBB/includes/mcp/mcp_forum.php | |
parent | 5c614ff6249c441637103ba0b78338f878057479 (diff) | |
download | forums-a50907250e487675baf9ac77be564b6ccb72b056.tar forums-a50907250e487675baf9ac77be564b6ccb72b056.tar.gz forums-a50907250e487675baf9ac77be564b6ccb72b056.tar.bz2 forums-a50907250e487675baf9ac77be564b6ccb72b056.tar.xz forums-a50907250e487675baf9ac77be564b6ccb72b056.zip |
[ticket/8610] Use phpbb_update_rows_avoiding_duplicates
PHPBB3-8610
Diffstat (limited to 'phpBB/includes/mcp/mcp_forum.php')
-rw-r--r-- | phpBB/includes/mcp/mcp_forum.php | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php index 78239698a9..097f67487d 100644 --- a/phpBB/includes/mcp/mcp_forum.php +++ b/phpBB/includes/mcp/mcp_forum.php @@ -423,17 +423,11 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) $db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE ' . $db->sql_in_set('topic_id', $topic_ids)); // If the topic no longer exist, we will update the bookmarks table. - // To not let it error out on users who bookmarked both topics, we just return on an error... - $db->sql_return_on_error(true); - $sql = 'UPDATE ' . BOOKMARKS_TABLE . ' - SET topic_id = ' . (int) $to_topic_id . ' - WHERE ' . $db->sql_in_set('topic_id', $topic_ids); - $db->sql_query($sql); - $db->sql_return_on_error(false); - - $sql = 'DELETE FROM ' . BOOKMARKS_TABLE . ' - WHERE ' . $db->sql_in_set('topic_id', $topic_ids); - $db->sql_query($sql); + if (!function_exists('phpbb_update_rows_avoiding_duplicates')) + { + include($phpbb_root_path . 'includes/functions_database_helper.' . $phpEx); + } + phpbb_update_rows_avoiding_duplicates($db, BOOKMARKS_TABLE, 'topic_id', $topic_ids, $to_topic_id); // 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>'); |