mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/8610] Use phpbb_update_rows_avoiding_duplicates
PHPBB3-8610
This commit is contained in:
parent
5c614ff624
commit
a50907250e
2 changed files with 6 additions and 22 deletions
|
@ -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));
|
$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.
|
// 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...
|
if (!function_exists('phpbb_update_rows_avoiding_duplicates'))
|
||||||
$db->sql_return_on_error(true);
|
{
|
||||||
$sql = 'UPDATE ' . BOOKMARKS_TABLE . '
|
include($phpbb_root_path . 'includes/functions_database_helper.' . $phpEx);
|
||||||
SET topic_id = ' . (int) $to_topic_id . '
|
}
|
||||||
WHERE ' . $db->sql_in_set('topic_id', $topic_ids);
|
phpbb_update_rows_avoiding_duplicates($db, BOOKMARKS_TABLE, 'topic_id', $topic_ids, $to_topic_id);
|
||||||
$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);
|
|
||||||
|
|
||||||
// Link to the new topic
|
// 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>');
|
$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>');
|
||||||
|
|
|
@ -671,17 +671,7 @@ function merge_posts($topic_id, $to_topic_id)
|
||||||
$db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE topic_id = ' . (int) $topic_id);
|
$db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE topic_id = ' . (int) $topic_id);
|
||||||
|
|
||||||
// If the topic no longer exist, we will update the bookmarks table.
|
// 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...
|
phpbb_update_rows_avoiding_duplicates($db, BOOKMARKS_TABLE, 'topic_id', $topic_id, $to_topic_id);
|
||||||
$db->sql_return_on_error(true);
|
|
||||||
$sql = 'UPDATE ' . BOOKMARKS_TABLE . '
|
|
||||||
SET topic_id = ' . (int) $to_topic_id . '
|
|
||||||
WHERE topic_id = ' . (int) $topic_id;
|
|
||||||
$db->sql_query($sql);
|
|
||||||
$db->sql_return_on_error(false);
|
|
||||||
|
|
||||||
$sql = 'DELETE FROM ' . BOOKMARKS_TABLE . '
|
|
||||||
WHERE topic_id = ' . (int) $topic_id;
|
|
||||||
$db->sql_query($sql);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Link to the new topic
|
// Link to the new topic
|
||||||
|
|
Loading…
Add table
Reference in a new issue