aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/mcp
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/mcp')
-rw-r--r--phpBB/includes/mcp/mcp_main.php8
-rw-r--r--phpBB/includes/mcp/mcp_topic.php42
2 files changed, 49 insertions, 1 deletions
diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php
index 491697d2e9..69c66639df 100644
--- a/phpBB/includes/mcp/mcp_main.php
+++ b/phpBB/includes/mcp/mcp_main.php
@@ -630,10 +630,13 @@ function mcp_move_topic($topic_ids)
*
* @event core.mcp_main_modify_shadow_sql
* @var array shadow SQL array to be used by $db->sql_build_array
+ * @var array row Topic data
* @since 3.1.11-RC1
+ * @changed 3.1.11-RC1 Added variable: row
*/
$vars = array(
'shadow',
+ 'row',
);
extract($phpbb_dispatcher->trigger_event('core.mcp_main_modify_shadow_sql', compact($vars)));
@@ -1297,11 +1300,14 @@ function mcp_fork_topic($topic_ids)
* Perform actions before forked topic is created.
*
* @event core.mcp_main_modify_fork_sql
- * @var array sql_ary SQL array to be used by $db->sql_build_array
+ * @var array sql_ary SQL array to be used by $db->sql_build_array
+ * @var array topic_row Topic data
* @since 3.1.11-RC1
+ * @changed 3.1.11-RC1 Added variable: topic_row
*/
$vars = array(
'sql_ary',
+ 'topic_row',
);
extract($phpbb_dispatcher->trigger_event('core.mcp_main_modify_fork_sql', compact($vars)));
diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php
index 2217f8fdeb..7dbe7787cb 100644
--- a/phpBB/includes/mcp/mcp_topic.php
+++ b/phpBB/includes/mcp/mcp_topic.php
@@ -407,6 +407,7 @@ function mcp_topic_view($id, $mode, $action)
function split_topic($action, $topic_id, $to_forum_id, $subject)
{
global $db, $template, $user, $phpEx, $phpbb_root_path, $auth, $config;
+ global $phpbb_dispatcher;
$post_id_list = request_var('post_id_list', array(0));
$forum_id = request_var('forum_id', 0);
@@ -567,6 +568,47 @@ function split_topic($action, $topic_id, $to_forum_id, $subject)
WHERE post_id = {$post_id_list[0]}";
$db->sql_query($sql);
+ // Grab data for first post in split topic
+ $sql_array = array(
+ 'SELECT' => 'p.post_id, p.forum_id, p.poster_id, p.post_text, f.enable_indexing',
+ 'FROM' => array(
+ POSTS_TABLE => 'p',
+ ),
+ 'LEFT_JOIN' => array(
+ array(
+ 'FROM' => array(FORUMS_TABLE => 'f'),
+ 'ON' => 'p.forum_id = f.forum_id',
+ )
+ ),
+ 'WHERE' => "post_id = {$post_id_list[0]}",
+ );
+ $sql = $db->sql_build_query('SELECT', $sql_array);
+ $result = $db->sql_query($sql);
+ $first_post_data = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
+ // Index first post as if it were edited
+ if ($first_post_data['enable_indexing'])
+ {
+ // Select the search method and do some additional checks to ensure it can actually be utilised
+ $search_type = $config['search_type'];
+
+ if (!class_exists($search_type))
+ {
+ trigger_error('NO_SUCH_SEARCH_MODULE');
+ }
+
+ $error = false;
+ $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher);
+
+ if ($error)
+ {
+ trigger_error($error);
+ }
+
+ $search->index('edit', $first_post_data['post_id'], $first_post_data['post_text'], $subject, $first_post_data['poster_id'], $first_post_data['forum_id']);
+ }
+
// Copy topic subscriptions to new topic
$sql = 'SELECT user_id, notify_status
FROM ' . TOPICS_WATCH_TABLE . '