From abcc59fca6bd5d899adbec248ba60db6c013e6a2 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 3 Sep 2012 15:10:08 -0500 Subject: [PATCH 01/11] [ticket/8610] Update Bookmarks when merging topics Update bookmarks to the new topic when merging multiple topics using the merge_topics function. PHPBB3-8610 --- phpBB/includes/mcp/mcp_forum.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php index b70601b479..865e464e81 100644 --- a/phpBB/includes/mcp/mcp_forum.php +++ b/phpBB/includes/mcp/mcp_forum.php @@ -422,6 +422,14 @@ 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); + $db->sql_query('UPDATE ' . BOOKMARKS_TABLE . ' SET topic_id = ' . (int) $to_topic_id . ' WHERE ' . $db->sql_in_set('topic_id', $topic_ids)); + $db->sql_return_on_error(false); + + $db->sql_query('DELETE FROM ' . BOOKMARKS_TABLE . ' WHERE ' . $db->sql_in_set('topic_id', $topic_ids)); + // Link to the new topic $return_link .= (($return_link) ? '

' : '') . sprintf($user->lang['RETURN_NEW_TOPIC'], '', ''); } @@ -444,4 +452,4 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) } } -?> \ No newline at end of file +?> From 8dd2a151cc53a5482fcf462736cf5c2eabccf599 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 3 Sep 2012 15:18:30 -0500 Subject: [PATCH 02/11] [ticket/8610] Update Bookmarks when forking topics Update bookmarks to the new topic when forking topics using the mcp_fork_topic function. PHPBB3-8610 --- phpBB/includes/mcp/mcp_main.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index ffede11d37..f7c49539ea 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -1251,6 +1251,26 @@ function mcp_fork_topic($topic_ids) { $db->sql_multi_insert(TOPICS_WATCH_TABLE, $sql_ary); } + + $sql = 'SELECT user_id + FROM ' . BOOKMARKS_TABLE . ' + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query($sql); + + $sql_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $sql_ary[] = array( + 'topic_id' => (int) $new_topic_id, + 'user_id' => (int) $row['user_id'], + ); + } + $db->sql_freeresult($result); + + if (sizeof($sql_ary)) + { + $db->sql_multi_insert(BOOKMARKS_TABLE, $sql_ary); + } } // Sync new topics, parent forums and board stats @@ -1314,4 +1334,4 @@ function mcp_fork_topic($topic_ids) } } -?> \ No newline at end of file +?> From 05d7decdd35eac3b58807b9ced318421a6ce15da Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 3 Sep 2012 15:30:52 -0500 Subject: [PATCH 03/11] [ticket/8610] Update Bookmarks when merging posts into another topic Update bookmarks to the new topic when merging posts into another topic using the merge_posts function. PHPBB3-8610 --- phpBB/includes/mcp/mcp_topic.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index 7d4edaf362..36cfe1e355 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -626,6 +626,14 @@ function merge_posts($topic_id, $to_topic_id) $db->sql_return_on_error(false); $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. + // To not let it error out on users who bookmarked both topics, we just return on an error... + $db->sql_return_on_error(true); + $db->sql_query('UPDATE ' . BOOKMARKS_TABLE . ' SET topic_id = ' . (int) $to_topic_id . ' WHERE topic_id = ' . (int) $topic_id); + $db->sql_return_on_error(false); + + $db->sql_query('DELETE FROM ' . BOOKMARKS_TABLE . ' WHERE topic_id = ' . (int) $topic_id); } // Link to the new topic @@ -650,4 +658,4 @@ function merge_posts($topic_id, $to_topic_id) } } -?> \ No newline at end of file +?> From 5a88bd1bf103537aece6713145fd13288cf3c329 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 3 Sep 2012 15:35:06 -0500 Subject: [PATCH 04/11] [ticket/8610] Update Bookmarks and Subscriptions when splitting topics Update bookmarks and subscriptions to add bookmarks/subscriptions to the new topic when using the split_topic function PHPBB3-8610 --- phpBB/includes/mcp/mcp_forum.php | 12 +++++-- phpBB/includes/mcp/mcp_topic.php | 56 ++++++++++++++++++++++++++++++-- 2 files changed, 64 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php index 865e464e81..ce709e7f71 100644 --- a/phpBB/includes/mcp/mcp_forum.php +++ b/phpBB/includes/mcp/mcp_forum.php @@ -98,6 +98,9 @@ function mcp_forum_view($id, $mode, $action, $forum_info) $forum_topics = ($total == -1) ? $forum_info['forum_topics'] : $total; $limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : ''; + $base_url = $url . "&i=$id&action=$action&mode=$mode&sd=$sort_dir&sk=$sort_key&st=$sort_days" . (($merge_select) ? $selected_ids : ''); + phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $forum_topics, $topics_per_page, $start); + $template->assign_vars(array( 'ACTION' => $action, 'FORUM_NAME' => $forum_info['forum_name'], @@ -425,10 +428,15 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) // 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); - $db->sql_query('UPDATE ' . BOOKMARKS_TABLE . ' SET topic_id = ' . (int) $to_topic_id . ' WHERE ' . $db->sql_in_set('topic_id', $topic_ids)); + $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); - $db->sql_query('DELETE FROM ' . BOOKMARKS_TABLE . ' WHERE ' . $db->sql_in_set('topic_id', $topic_ids)); + $sql = 'DELETE FROM ' . BOOKMARKS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $topic_ids); + $db->sql_query($sql); // Link to the new topic $return_link .= (($return_link) ? '

' : '') . sprintf($user->lang['RETURN_NEW_TOPIC'], '', ''); diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index 36cfe1e355..f0775f9137 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -307,6 +307,12 @@ function mcp_topic_view($id, $mode, $action) 'post_ids' => $post_id_list, )); + $base_url = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&t={$topic_info['topic_id']}&mode=$mode&action=$action&to_topic_id=$to_topic_id&posts_per_page=$posts_per_page&st=$sort_days&sk=$sort_key&sd=$sort_dir"); + if ($posts_per_page) + { + phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $total, $posts_per_page, $start); + } + $template->assign_vars(array( 'TOPIC_TITLE' => $topic_info['topic_title'], 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $topic_info['forum_id'] . '&t=' . $topic_info['topic_id']), @@ -517,6 +523,47 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) WHERE post_id = {$post_id_list[0]}"; $db->sql_query($sql); + $sql = 'SELECT user_id, notify_status + FROM ' . TOPICS_WATCH_TABLE . ' + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query($sql); + + $sql_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $sql_ary[] = array( + 'topic_id' => (int) $to_topic_id, + 'user_id' => (int) $row['user_id'], + 'notify_status' => (int) $row['notify_status'], + ); + } + $db->sql_freeresult($result); + + if (sizeof($sql_ary)) + { + $db->sql_multi_insert(TOPICS_WATCH_TABLE, $sql_ary); + } + + $sql = 'SELECT user_id + FROM ' . BOOKMARKS_TABLE . ' + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query($sql); + + $sql_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $sql_ary[] = array( + 'topic_id' => (int) $to_topic_id, + 'user_id' => (int) $row['user_id'], + ); + } + $db->sql_freeresult($result); + + if (sizeof($sql_ary)) + { + $db->sql_multi_insert(BOOKMARKS_TABLE, $sql_ary); + } + $success_msg = 'TOPIC_SPLIT_SUCCESS'; // Update forum statistics @@ -630,10 +677,15 @@ function merge_posts($topic_id, $to_topic_id) // 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); - $db->sql_query('UPDATE ' . BOOKMARKS_TABLE . ' SET topic_id = ' . (int) $to_topic_id . ' WHERE topic_id = ' . (int) $topic_id); + $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); - $db->sql_query('DELETE FROM ' . BOOKMARKS_TABLE . ' WHERE topic_id = ' . (int) $topic_id); + $sql = 'DELETE FROM ' . BOOKMARKS_TABLE . ' + WHERE topic_id = ' . (int) $topic_id; + $db->sql_query($sql); } // Link to the new topic From 71bcc58feecd49fe05f6b7e0e2bca8a94424f240 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Tue, 30 Oct 2012 12:27:02 -0500 Subject: [PATCH 05/11] [ticket/8610] Add some comments PHPBB3-8610 --- phpBB/includes/mcp/mcp_main.php | 2 ++ phpBB/includes/mcp/mcp_topic.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index f7c49539ea..cce4db8b4d 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -1231,6 +1231,7 @@ function mcp_fork_topic($topic_ids) } } + // Copy topic subscriptions to new topic $sql = 'SELECT user_id, notify_status FROM ' . TOPICS_WATCH_TABLE . ' WHERE topic_id = ' . $topic_id; @@ -1252,6 +1253,7 @@ function mcp_fork_topic($topic_ids) $db->sql_multi_insert(TOPICS_WATCH_TABLE, $sql_ary); } + // Copy bookmarks to new topic $sql = 'SELECT user_id FROM ' . BOOKMARKS_TABLE . ' WHERE topic_id = ' . $topic_id; diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index f0775f9137..28f5c6a41d 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -523,6 +523,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) WHERE post_id = {$post_id_list[0]}"; $db->sql_query($sql); + // Copy topic subscriptions to new topic $sql = 'SELECT user_id, notify_status FROM ' . TOPICS_WATCH_TABLE . ' WHERE topic_id = ' . $topic_id; @@ -544,6 +545,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) $db->sql_multi_insert(TOPICS_WATCH_TABLE, $sql_ary); } + // Copy bookmarks to new topic $sql = 'SELECT user_id FROM ' . BOOKMARKS_TABLE . ' WHERE topic_id = ' . $topic_id; From 5c614ff6249c441637103ba0b78338f878057479 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 13 Dec 2012 20:30:16 -0600 Subject: [PATCH 06/11] [ticket/8610] Revert some funky merging I did from rebase PHPBB3-8610 --- phpBB/includes/mcp/mcp_forum.php | 5 +---- phpBB/includes/mcp/mcp_main.php | 2 +- phpBB/includes/mcp/mcp_topic.php | 8 +------- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php index ce709e7f71..78239698a9 100644 --- a/phpBB/includes/mcp/mcp_forum.php +++ b/phpBB/includes/mcp/mcp_forum.php @@ -98,9 +98,6 @@ function mcp_forum_view($id, $mode, $action, $forum_info) $forum_topics = ($total == -1) ? $forum_info['forum_topics'] : $total; $limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : ''; - $base_url = $url . "&i=$id&action=$action&mode=$mode&sd=$sort_dir&sk=$sort_key&st=$sort_days" . (($merge_select) ? $selected_ids : ''); - phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $forum_topics, $topics_per_page, $start); - $template->assign_vars(array( 'ACTION' => $action, 'FORUM_NAME' => $forum_info['forum_name'], @@ -460,4 +457,4 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) } } -?> +?> \ No newline at end of file diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index cce4db8b4d..0cef8933fc 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -1336,4 +1336,4 @@ function mcp_fork_topic($topic_ids) } } -?> +?> \ No newline at end of file diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index 28f5c6a41d..ba11b04884 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -307,12 +307,6 @@ function mcp_topic_view($id, $mode, $action) 'post_ids' => $post_id_list, )); - $base_url = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&t={$topic_info['topic_id']}&mode=$mode&action=$action&to_topic_id=$to_topic_id&posts_per_page=$posts_per_page&st=$sort_days&sk=$sort_key&sd=$sort_dir"); - if ($posts_per_page) - { - phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $total, $posts_per_page, $start); - } - $template->assign_vars(array( 'TOPIC_TITLE' => $topic_info['topic_title'], 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $topic_info['forum_id'] . '&t=' . $topic_info['topic_id']), @@ -712,4 +706,4 @@ function merge_posts($topic_id, $to_topic_id) } } -?> +?> \ No newline at end of file From a50907250e487675baf9ac77be564b6ccb72b056 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 13 Dec 2012 20:42:10 -0600 Subject: [PATCH 07/11] [ticket/8610] Use phpbb_update_rows_avoiding_duplicates PHPBB3-8610 --- phpBB/includes/mcp/mcp_forum.php | 16 +++++----------- phpBB/includes/mcp/mcp_topic.php | 12 +----------- 2 files changed, 6 insertions(+), 22 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) ? '

' : '') . sprintf($user->lang['RETURN_NEW_TOPIC'], '', ''); diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index ba11b04884..29d7a0e41b 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -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); // 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 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); + phpbb_update_rows_avoiding_duplicates($db, BOOKMARKS_TABLE, 'topic_id', $topic_id, $to_topic_id); } // Link to the new topic From 9eb9fa2b9d117b919dfcc1e37d6c1186841b4fe7 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 13 Dec 2012 22:38:17 -0600 Subject: [PATCH 08/11] [ticket/8610] Create helper functions to create topic/post in functional tests This will be used to test splitting/copying/merging/etc in functional tests Also convert functional posting_test.php to use these functions PHPBB3-8610 --- tests/functional/posting_test.php | 89 ++------------- .../phpbb_functional_test_case.php | 101 ++++++++++++++++++ 2 files changed, 112 insertions(+), 78 deletions(-) diff --git a/tests/functional/posting_test.php b/tests/functional/posting_test.php index f54a3591b2..6aa7a46974 100644 --- a/tests/functional/posting_test.php +++ b/tests/functional/posting_test.php @@ -15,88 +15,21 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case public function test_post_new_topic() { $this->login(); - $this->add_lang('posting'); - $crawler = $this->request('GET', 'posting.php?mode=post&f=2&sid=' . $this->sid); - $this->assertContains($this->lang('POST_TOPIC'), $crawler->filter('html')->text()); + // Test creating topic + $post = $this->create_topic(2, 'Test Topic 1', 'This is a test topic posted by the testing framework.'); - $hidden_fields = array(); - $hidden_fields[] = $crawler->filter('[type="hidden"]')->each(function ($node, $i) { - return array('name' => $node->getAttribute('name'), 'value' => $node->getAttribute('value')); - }); + $crawler = $this->request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}"); + $this->assertContains('This is a test topic posted by the testing framework.', $crawler->filter('html')->text()); - $test_message = 'This is a test topic posted by the testing framework.'; - $form_data = array( - 'subject' => 'Test Topic 1', - 'message' => $test_message, - 'post' => true, - 'f' => 2, - 'mode' => 'post', - 'sid' => $this->sid, - ); + // Test creating a reply + $post2 = $this->create_post(2, $post['topic_id'], 'Re: Test Topic 1', 'This is a test post posted by the testing framework.'); - foreach ($hidden_fields as $fields) - { - foreach($fields as $field) - { - $form_data[$field['name']] = $field['value']; - } - } + $crawler = $this->request('GET', "viewtopic.php?t={$post2['topic_id']}&sid={$this->sid}"); + $this->assertContains('This is a test post posted by the testing framework.', $crawler->filter('html')->text()); - // Bypass time restriction that said that if the lastclick time (i.e. time when the form was opened) - // is not at least 2 seconds before submission, cancel the form - $form_data['lastclick'] = 0; - - // I use a request because the form submission method does not allow you to send data that is not - // contained in one of the actual form fields that the browser sees (i.e. it ignores "hidden" inputs) - // Instead, I send it as a request with the submit button "post" set to true. - $crawler = $this->client->request('POST', 'posting.php', $form_data); - $this->assertContains($this->lang('POST_STORED'), $crawler->filter('html')->text()); - - $crawler = $this->request('GET', 'viewtopic.php?t=2&sid=' . $this->sid); - $this->assertContains($test_message, $crawler->filter('html')->text()); - } - - public function test_post_reply() - { - $this->login(); - $this->add_lang('posting'); - - $crawler = $this->request('GET', 'posting.php?mode=reply&t=2&f=2&sid=' . $this->sid); - $this->assertContains($this->lang('POST_REPLY'), $crawler->filter('html')->text()); - - $hidden_fields = array(); - $hidden_fields[] = $crawler->filter('[type="hidden"]')->each(function ($node, $i) { - return array('name' => $node->getAttribute('name'), 'value' => $node->getAttribute('value')); - }); - - $test_message = 'This is a test post posted by the testing framework.'; - $form_data = array( - 'subject' => 'Re: Test Topic 1', - 'message' => $test_message, - 'post' => true, - 't' => 2, - 'f' => 2, - 'mode' => 'reply', - 'sid' => $this->sid, - ); - - foreach ($hidden_fields as $fields) - { - foreach($fields as $field) - { - $form_data[$field['name']] = $field['value']; - } - } - - // For reasoning behind the following command, see the test_post_new_topic() test - $form_data['lastclick'] = 0; - - // Submit the post - $crawler = $this->client->request('POST', 'posting.php', $form_data); - $this->assertContains($this->lang('POST_STORED'), $crawler->filter('html')->text()); - - $crawler = $this->request('GET', 'viewtopic.php?t=2&sid=' . $this->sid); - $this->assertContains($test_message, $crawler->filter('html')->text()); + // Test quoting a message + $crawler = $this->request('GET', "posting.php?mode=quote&f=2&t={$post2['topic_id']}&p={$post2['post_id']}&sid={$this->sid}"); + $this->assertContains('This is a test post posted by the testing framework.', $crawler->filter('html')->text()); } } diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 8ab6469e9a..e6a9023a3b 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -275,6 +275,107 @@ class phpbb_functional_test_case extends phpbb_test_case return user_add($user_row); } + /** + * Creates a topic + * + * Be sure to login before creating + * + * @param int $forum_id + * @param string $subject + * @param string $message + * @param array $additional_form_data Any additional form data to be sent in the request + * @return array post_id, topic_id + */ + protected function create_topic($forum_id, $subject, $message, $additional_form_data = array()) + { + $posting_url = "posting.php?mode=post&f={$forum_id}&sid={$this->sid}"; + + $form_data = array_merge(array( + 'subject' => $subject, + 'message' => $message, + 'post' => true, + ), $additional_form_data); + + return $this->submit_post($posting_url, 'POST_TOPIC', $form_data); + } + + /** + * Creates a post + * + * Be sure to login before creating + * + * @param int $forum_id + * @param string $subject + * @param string $message + * @param array $additional_form_data Any additional form data to be sent in the request + * @return array post_id, topic_id + */ + protected function create_post($forum_id, $topic_id, $subject, $message, $additional_form_data = array()) + { + $posting_url = "posting.php?mode=reply&f={$forum_id}&t={$topic_id}&sid={$this->sid}"; + + $form_data = array_merge(array( + 'subject' => $subject, + 'message' => $message, + 'post' => true, + ), $additional_form_data); + + return $this->submit_post($posting_url, 'POST_REPLY', $form_data); + } + + /** + * Helper for submitting posts + * + * @param string $posting_url + * @param string $posting_contains + * @param array $form_data + * @return array post_id, topic_id + */ + protected function submit_post($posting_url, $posting_contains, $form_data) + { + $this->add_lang('posting'); + + $crawler = $this->request('GET', $posting_url); + $this->assertContains($this->lang($posting_contains), $crawler->filter('html')->text()); + + $hidden_fields = array( + $crawler->filter('[type="hidden"]')->each(function ($node, $i) { + return array('name' => $node->getAttribute('name'), 'value' => $node->getAttribute('value')); + }), + ); + + foreach ($hidden_fields as $fields) + { + foreach($fields as $field) + { + $form_data[$field['name']] = $field['value']; + } + } + + // Bypass time restriction that said that if the lastclick time (i.e. time when the form was opened) + // is not at least 2 seconds before submission, cancel the form + $form_data['lastclick'] = 0; + + // I use a request because the form submission method does not allow you to send data that is not + // contained in one of the actual form fields that the browser sees (i.e. it ignores "hidden" inputs) + // Instead, I send it as a request with the submit button "post" set to true. + $crawler = $this->client->request('POST', $posting_url, $form_data); + $this->assertContains($this->lang('POST_STORED'), $crawler->filter('html')->text()); + + $url = $crawler->selectLink(str_replace('%s', '', $this->lang['VIEW_MESSAGE']))->link()->getUri(); + + $matches = $topic_id = $post_id = false; + preg_match_all('#&t=([0-9]+)(&p=([0-9]+))?#', $url, $matches); + + $topic_id = (int) (isset($matches[1][0])) ? $matches[1][0] : 0; + $post_id = (int) (isset($matches[3][0])) ? $matches[3][0] : 0; + + return array( + 'topic_id' => $topic_id, + 'post_id' => $post_id, + ); + } + protected function login($username = 'admin') { $this->add_lang('ucp'); From d739745ea4ccc224b6b7fb686339138733c2203d Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 13 Dec 2012 23:09:45 -0600 Subject: [PATCH 09/11] [ticket/8610] Move posting helpers to separate file This is to prevent cluttering up the functional test case class more PHPBB3-8610 --- tests/functional/posting_test.php | 8 +- .../phpbb_functional_test_case.php | 115 ++--------------- tests/test_framework/posting_helpers.php | 119 ++++++++++++++++++ 3 files changed, 137 insertions(+), 105 deletions(-) create mode 100644 tests/test_framework/posting_helpers.php diff --git a/tests/functional/posting_test.php b/tests/functional/posting_test.php index 6aa7a46974..dd078286d6 100644 --- a/tests/functional/posting_test.php +++ b/tests/functional/posting_test.php @@ -15,15 +15,19 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case public function test_post_new_topic() { $this->login(); + + include(__DIR__ . './../test_framework/posting_helpers.php'); + + $posting_helper = new phpbb_test_framework_posting_helpers($this); // Test creating topic - $post = $this->create_topic(2, 'Test Topic 1', 'This is a test topic posted by the testing framework.'); + $post = $posting_helper->create_topic(2, 'Test Topic 1', 'This is a test topic posted by the testing framework.'); $crawler = $this->request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}"); $this->assertContains('This is a test topic posted by the testing framework.', $crawler->filter('html')->text()); // Test creating a reply - $post2 = $this->create_post(2, $post['topic_id'], 'Re: Test Topic 1', 'This is a test post posted by the testing framework.'); + $post2 = $posting_helper->create_post(2, $post['topic_id'], 'Re: Test Topic 1', 'This is a test post posted by the testing framework.'); $crawler = $this->request('GET', "viewtopic.php?t={$post2['topic_id']}&sid={$this->sid}"); $this->assertContains('This is a test post posted by the testing framework.', $crawler->filter('html')->text()); diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index e6a9023a3b..097db62e29 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -275,107 +275,6 @@ class phpbb_functional_test_case extends phpbb_test_case return user_add($user_row); } - /** - * Creates a topic - * - * Be sure to login before creating - * - * @param int $forum_id - * @param string $subject - * @param string $message - * @param array $additional_form_data Any additional form data to be sent in the request - * @return array post_id, topic_id - */ - protected function create_topic($forum_id, $subject, $message, $additional_form_data = array()) - { - $posting_url = "posting.php?mode=post&f={$forum_id}&sid={$this->sid}"; - - $form_data = array_merge(array( - 'subject' => $subject, - 'message' => $message, - 'post' => true, - ), $additional_form_data); - - return $this->submit_post($posting_url, 'POST_TOPIC', $form_data); - } - - /** - * Creates a post - * - * Be sure to login before creating - * - * @param int $forum_id - * @param string $subject - * @param string $message - * @param array $additional_form_data Any additional form data to be sent in the request - * @return array post_id, topic_id - */ - protected function create_post($forum_id, $topic_id, $subject, $message, $additional_form_data = array()) - { - $posting_url = "posting.php?mode=reply&f={$forum_id}&t={$topic_id}&sid={$this->sid}"; - - $form_data = array_merge(array( - 'subject' => $subject, - 'message' => $message, - 'post' => true, - ), $additional_form_data); - - return $this->submit_post($posting_url, 'POST_REPLY', $form_data); - } - - /** - * Helper for submitting posts - * - * @param string $posting_url - * @param string $posting_contains - * @param array $form_data - * @return array post_id, topic_id - */ - protected function submit_post($posting_url, $posting_contains, $form_data) - { - $this->add_lang('posting'); - - $crawler = $this->request('GET', $posting_url); - $this->assertContains($this->lang($posting_contains), $crawler->filter('html')->text()); - - $hidden_fields = array( - $crawler->filter('[type="hidden"]')->each(function ($node, $i) { - return array('name' => $node->getAttribute('name'), 'value' => $node->getAttribute('value')); - }), - ); - - foreach ($hidden_fields as $fields) - { - foreach($fields as $field) - { - $form_data[$field['name']] = $field['value']; - } - } - - // Bypass time restriction that said that if the lastclick time (i.e. time when the form was opened) - // is not at least 2 seconds before submission, cancel the form - $form_data['lastclick'] = 0; - - // I use a request because the form submission method does not allow you to send data that is not - // contained in one of the actual form fields that the browser sees (i.e. it ignores "hidden" inputs) - // Instead, I send it as a request with the submit button "post" set to true. - $crawler = $this->client->request('POST', $posting_url, $form_data); - $this->assertContains($this->lang('POST_STORED'), $crawler->filter('html')->text()); - - $url = $crawler->selectLink(str_replace('%s', '', $this->lang['VIEW_MESSAGE']))->link()->getUri(); - - $matches = $topic_id = $post_id = false; - preg_match_all('#&t=([0-9]+)(&p=([0-9]+))?#', $url, $matches); - - $topic_id = (int) (isset($matches[1][0])) ? $matches[1][0] : 0; - $post_id = (int) (isset($matches[3][0])) ? $matches[3][0] : 0; - - return array( - 'topic_id' => $topic_id, - 'post_id' => $post_id, - ); - } - protected function login($username = 'admin') { $this->add_lang('ucp'); @@ -400,7 +299,7 @@ class phpbb_functional_test_case extends phpbb_test_case } } - protected function add_lang($lang_file) + public function add_lang($lang_file) { if (is_array($lang_file)) { @@ -422,7 +321,7 @@ class phpbb_functional_test_case extends phpbb_test_case $this->lang = array_merge($this->lang, $lang); } - protected function lang() + public function lang() { $args = func_get_args(); $key = $args[0]; @@ -451,4 +350,14 @@ class phpbb_functional_test_case extends phpbb_test_case $content = $this->client->getResponse()->getContent(); $this->assertNotContains('Fatal error:', $content); } + + public function get_sid() + { + return $this->sid; + } + + public function get_client() + { + return $this->client; + } } diff --git a/tests/test_framework/posting_helpers.php b/tests/test_framework/posting_helpers.php new file mode 100644 index 0000000000..329cf5a1b4 --- /dev/null +++ b/tests/test_framework/posting_helpers.php @@ -0,0 +1,119 @@ +test_case = $test_case; + } + + /** + * Creates a topic + * + * Be sure to login before creating + * + * @param int $forum_id + * @param string $subject + * @param string $message + * @param array $additional_form_data Any additional form data to be sent in the request + * @return array post_id, topic_id + */ + public function create_topic($forum_id, $subject, $message, $additional_form_data = array()) + { + $posting_url = "posting.php?mode=post&f={$forum_id}&sid={$this->test_case->get_sid()}"; + + $form_data = array_merge(array( + 'subject' => $subject, + 'message' => $message, + 'post' => true, + ), $additional_form_data); + + return $this->submit_post($posting_url, 'POST_TOPIC', $form_data); + } + + /** + * Creates a post + * + * Be sure to login before creating + * + * @param int $forum_id + * @param string $subject + * @param string $message + * @param array $additional_form_data Any additional form data to be sent in the request + * @return array post_id, topic_id + */ + public function create_post($forum_id, $topic_id, $subject, $message, $additional_form_data = array()) + { + $posting_url = "posting.php?mode=reply&f={$forum_id}&t={$topic_id}&sid={$this->test_case->get_sid()}"; + + $form_data = array_merge(array( + 'subject' => $subject, + 'message' => $message, + 'post' => true, + ), $additional_form_data); + + return $this->submit_post($posting_url, 'POST_REPLY', $form_data); + } + + /** + * Helper for submitting posts + * + * @param string $posting_url + * @param string $posting_contains + * @param array $form_data + * @return array post_id, topic_id + */ + protected function submit_post($posting_url, $posting_contains, $form_data) + { + $this->test_case->add_lang('posting'); + + $crawler = $this->test_case->request('GET', $posting_url); + $this->test_case->assertContains($this->test_case->lang($posting_contains), $crawler->filter('html')->text()); + + $hidden_fields = array( + $crawler->filter('[type="hidden"]')->each(function ($node, $i) { + return array('name' => $node->getAttribute('name'), 'value' => $node->getAttribute('value')); + }), + ); + + foreach ($hidden_fields as $fields) + { + foreach($fields as $field) + { + $form_data[$field['name']] = $field['value']; + } + } + + // Bypass time restriction that said that if the lastclick time (i.e. time when the form was opened) + // is not at least 2 seconds before submission, cancel the form + $form_data['lastclick'] = 0; + + // I use a request because the form submission method does not allow you to send data that is not + // contained in one of the actual form fields that the browser sees (i.e. it ignores "hidden" inputs) + // Instead, I send it as a request with the submit button "post" set to true. + $crawler = $this->test_case->get_client()->request('POST', $posting_url, $form_data); + $this->test_case->assertContains($this->test_case->lang('POST_STORED'), $crawler->filter('html')->text()); + + $url = $crawler->selectLink($this->test_case->lang('VIEW_MESSAGE', '', ''))->link()->getUri(); + + $matches = $topic_id = $post_id = false; + preg_match_all('#&t=([0-9]+)(&p=([0-9]+))?#', $url, $matches); + + $topic_id = (int) (isset($matches[1][0])) ? $matches[1][0] : 0; + $post_id = (int) (isset($matches[3][0])) ? $matches[3][0] : 0; + + return array( + 'topic_id' => $topic_id, + 'post_id' => $post_id, + ); + } +} From 175b6deb6d263a3184d4b51cb1f00137cadc542e Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sat, 15 Dec 2012 16:22:54 -0600 Subject: [PATCH 10/11] [ticket/8610] Do not use requests to submit posts except in posting_test.php Moving my functional test functions from posting_helpers.php to posting_test.php since it is a bit nicer and more reusable if posting_test.php is to be expanded in the future. PHPBB3-8610 --- tests/functional/posting_test.php | 112 ++++++++++++++++- .../phpbb_functional_test_case.php | 14 +-- tests/test_framework/posting_helpers.php | 119 ------------------ 3 files changed, 108 insertions(+), 137 deletions(-) delete mode 100644 tests/test_framework/posting_helpers.php diff --git a/tests/functional/posting_test.php b/tests/functional/posting_test.php index dd078286d6..d05207edf0 100644 --- a/tests/functional/posting_test.php +++ b/tests/functional/posting_test.php @@ -15,25 +15,125 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case public function test_post_new_topic() { $this->login(); - - include(__DIR__ . './../test_framework/posting_helpers.php'); - - $posting_helper = new phpbb_test_framework_posting_helpers($this); // Test creating topic - $post = $posting_helper->create_topic(2, 'Test Topic 1', 'This is a test topic posted by the testing framework.'); + $post = $this->create_topic(2, 'Test Topic 1', 'This is a test topic posted by the testing framework.'); $crawler = $this->request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}"); $this->assertContains('This is a test topic posted by the testing framework.', $crawler->filter('html')->text()); // Test creating a reply - $post2 = $posting_helper->create_post(2, $post['topic_id'], 'Re: Test Topic 1', 'This is a test post posted by the testing framework.'); + $post2 = $this->create_post(2, $post['topic_id'], 'Re: Test Topic 1', 'This is a test post posted by the testing framework.'); $crawler = $this->request('GET', "viewtopic.php?t={$post2['topic_id']}&sid={$this->sid}"); $this->assertContains('This is a test post posted by the testing framework.', $crawler->filter('html')->text()); // Test quoting a message $crawler = $this->request('GET', "posting.php?mode=quote&f=2&t={$post2['topic_id']}&p={$post2['post_id']}&sid={$this->sid}"); + $this->assert_response_success(); $this->assertContains('This is a test post posted by the testing framework.', $crawler->filter('html')->text()); } + + /** + * Creates a topic + * + * Be sure to login before creating + * + * @param int $forum_id + * @param string $subject + * @param string $message + * @param array $additional_form_data Any additional form data to be sent in the request + * @return array post_id, topic_id + */ + public function create_topic($forum_id, $subject, $message, $additional_form_data = array()) + { + $posting_url = "posting.php?mode=post&f={$forum_id}&sid={$this->sid}"; + + $form_data = array_merge(array( + 'subject' => $subject, + 'message' => $message, + 'post' => true, + ), $additional_form_data); + + return $this->submit_post($posting_url, 'POST_TOPIC', $form_data); + } + + /** + * Creates a post + * + * Be sure to login before creating + * + * @param int $forum_id + * @param string $subject + * @param string $message + * @param array $additional_form_data Any additional form data to be sent in the request + * @return array post_id, topic_id + */ + public function create_post($forum_id, $topic_id, $subject, $message, $additional_form_data = array()) + { + $posting_url = "posting.php?mode=reply&f={$forum_id}&t={$topic_id}&sid={$this->sid}"; + + $form_data = array_merge(array( + 'subject' => $subject, + 'message' => $message, + 'post' => true, + ), $additional_form_data); + + return $this->submit_post($posting_url, 'POST_REPLY', $form_data); + } + + /** + * Helper for submitting posts + * + * @param string $posting_url + * @param string $posting_contains + * @param array $form_data + * @return array post_id, topic_id + */ + protected function submit_post($posting_url, $posting_contains, $form_data) + { + $this->add_lang('posting'); + + $crawler = $this->request('GET', $posting_url); + $this->assert_response_success(); + $this->assertContains($this->lang($posting_contains), $crawler->filter('html')->text()); + + $hidden_fields = array( + $crawler->filter('[type="hidden"]')->each(function ($node, $i) { + return array('name' => $node->getAttribute('name'), 'value' => $node->getAttribute('value')); + }), + ); + + foreach ($hidden_fields as $fields) + { + foreach($fields as $field) + { + $form_data[$field['name']] = $field['value']; + } + } + + // Bypass time restriction that said that if the lastclick time (i.e. time when the form was opened) + // is not at least 2 seconds before submission, cancel the form + $form_data['lastclick'] = 0; + + // I use a request because the form submission method does not allow you to send data that is not + // contained in one of the actual form fields that the browser sees (i.e. it ignores "hidden" inputs) + // Instead, I send it as a request with the submit button "post" set to true. + $crawler = $this->client->request('POST', $posting_url, $form_data); + $this->assert_response_success(); + $this->assertContains($this->lang('POST_STORED'), $crawler->filter('html')->text()); + + $url = $crawler->selectLink($this->lang('VIEW_MESSAGE', '', ''))->link()->getUri(); + + $matches = $topic_id = $post_id = false; + preg_match_all('#&t=([0-9]+)(&p=([0-9]+))?#', $url, $matches); + + $topic_id = (int) (isset($matches[1][0])) ? $matches[1][0] : 0; + $post_id = (int) (isset($matches[3][0])) ? $matches[3][0] : 0; + + return array( + 'topic_id' => $topic_id, + 'post_id' => $post_id, + ); + } } diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 097db62e29..8ab6469e9a 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -299,7 +299,7 @@ class phpbb_functional_test_case extends phpbb_test_case } } - public function add_lang($lang_file) + protected function add_lang($lang_file) { if (is_array($lang_file)) { @@ -321,7 +321,7 @@ class phpbb_functional_test_case extends phpbb_test_case $this->lang = array_merge($this->lang, $lang); } - public function lang() + protected function lang() { $args = func_get_args(); $key = $args[0]; @@ -350,14 +350,4 @@ class phpbb_functional_test_case extends phpbb_test_case $content = $this->client->getResponse()->getContent(); $this->assertNotContains('Fatal error:', $content); } - - public function get_sid() - { - return $this->sid; - } - - public function get_client() - { - return $this->client; - } } diff --git a/tests/test_framework/posting_helpers.php b/tests/test_framework/posting_helpers.php deleted file mode 100644 index 329cf5a1b4..0000000000 --- a/tests/test_framework/posting_helpers.php +++ /dev/null @@ -1,119 +0,0 @@ -test_case = $test_case; - } - - /** - * Creates a topic - * - * Be sure to login before creating - * - * @param int $forum_id - * @param string $subject - * @param string $message - * @param array $additional_form_data Any additional form data to be sent in the request - * @return array post_id, topic_id - */ - public function create_topic($forum_id, $subject, $message, $additional_form_data = array()) - { - $posting_url = "posting.php?mode=post&f={$forum_id}&sid={$this->test_case->get_sid()}"; - - $form_data = array_merge(array( - 'subject' => $subject, - 'message' => $message, - 'post' => true, - ), $additional_form_data); - - return $this->submit_post($posting_url, 'POST_TOPIC', $form_data); - } - - /** - * Creates a post - * - * Be sure to login before creating - * - * @param int $forum_id - * @param string $subject - * @param string $message - * @param array $additional_form_data Any additional form data to be sent in the request - * @return array post_id, topic_id - */ - public function create_post($forum_id, $topic_id, $subject, $message, $additional_form_data = array()) - { - $posting_url = "posting.php?mode=reply&f={$forum_id}&t={$topic_id}&sid={$this->test_case->get_sid()}"; - - $form_data = array_merge(array( - 'subject' => $subject, - 'message' => $message, - 'post' => true, - ), $additional_form_data); - - return $this->submit_post($posting_url, 'POST_REPLY', $form_data); - } - - /** - * Helper for submitting posts - * - * @param string $posting_url - * @param string $posting_contains - * @param array $form_data - * @return array post_id, topic_id - */ - protected function submit_post($posting_url, $posting_contains, $form_data) - { - $this->test_case->add_lang('posting'); - - $crawler = $this->test_case->request('GET', $posting_url); - $this->test_case->assertContains($this->test_case->lang($posting_contains), $crawler->filter('html')->text()); - - $hidden_fields = array( - $crawler->filter('[type="hidden"]')->each(function ($node, $i) { - return array('name' => $node->getAttribute('name'), 'value' => $node->getAttribute('value')); - }), - ); - - foreach ($hidden_fields as $fields) - { - foreach($fields as $field) - { - $form_data[$field['name']] = $field['value']; - } - } - - // Bypass time restriction that said that if the lastclick time (i.e. time when the form was opened) - // is not at least 2 seconds before submission, cancel the form - $form_data['lastclick'] = 0; - - // I use a request because the form submission method does not allow you to send data that is not - // contained in one of the actual form fields that the browser sees (i.e. it ignores "hidden" inputs) - // Instead, I send it as a request with the submit button "post" set to true. - $crawler = $this->test_case->get_client()->request('POST', $posting_url, $form_data); - $this->test_case->assertContains($this->test_case->lang('POST_STORED'), $crawler->filter('html')->text()); - - $url = $crawler->selectLink($this->test_case->lang('VIEW_MESSAGE', '', ''))->link()->getUri(); - - $matches = $topic_id = $post_id = false; - preg_match_all('#&t=([0-9]+)(&p=([0-9]+))?#', $url, $matches); - - $topic_id = (int) (isset($matches[1][0])) ? $matches[1][0] : 0; - $post_id = (int) (isset($matches[3][0])) ? $matches[3][0] : 0; - - return array( - 'topic_id' => $topic_id, - 'post_id' => $post_id, - ); - } -} From 649e009f7b42a751d7b208bd5a4659c0fc442912 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sat, 15 Dec 2012 16:23:48 -0600 Subject: [PATCH 11/11] [ticket/8610] Update comment PHPBB3-8610 --- phpBB/includes/mcp/mcp_forum.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php index de2966d34e..04e0e70f1d 100644 --- a/phpBB/includes/mcp/mcp_forum.php +++ b/phpBB/includes/mcp/mcp_forum.php @@ -422,7 +422,7 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) // Update the topic watch table. phpbb_update_rows_avoiding_duplicates_notify_status($db, TOPICS_WATCH_TABLE, 'topic_id', $topic_ids, $to_topic_id); - // If the topic no longer exist, we will update the bookmarks table. + // Update the bookmarks table. phpbb_update_rows_avoiding_duplicates($db, BOOKMARKS_TABLE, 'topic_id', $topic_ids, $to_topic_id); // Link to the new topic