From e30c6caac8ea71086625348c39e25f000cf531d6 Mon Sep 17 00:00:00 2001 From: alf007 Date: Fri, 15 May 2015 19:45:28 +0200 Subject: [PATCH 1/3] [ticket/13311] Add core event on acp_forums for forum content deletes Event added for the function delete_forum_content() in includes/acp/acp_forums.php, so that you can insert any extension's table(s) to be updated when forum content is deleted Incude parameters forum_id, topic_ids and post_counts PHPBB3-13311 --- phpBB/includes/acp/acp_forums.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index adf5de44f5..d457c5dd70 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -1786,7 +1786,7 @@ class acp_forums */ function delete_forum_content($forum_id) { - global $db, $config, $phpbb_root_path, $phpEx; + global $db, $config, $phpbb_root_path, $phpEx, $phpbb_dispatcher; include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); @@ -1918,6 +1918,24 @@ class acp_forums $table_ary = array(FORUMS_ACCESS_TABLE, FORUMS_TRACK_TABLE, FORUMS_WATCH_TABLE, LOG_TABLE, MODERATOR_CACHE_TABLE, POSTS_TABLE, TOPICS_TABLE, TOPICS_TRACK_TABLE); + /** + * Perform additional actions before forum content deletion + * + * @event core.delete_forum_content_before_query + * @var array table_ary Array of tables from which all rows will be deleted that hold the forum_id + * @var int forum_id the forum id + * @var array topic_ids Array of the topic ids from the forum to be deleted + * @var array post_counts Array of counts of posts in the forum, by poster_id + * @since 3.1.5-RC1 + */ + $vars = array( + 'table_ary', + 'forum_id', + 'topic_ids', + 'post_counts', + ); + extract($phpbb_dispatcher->trigger_event('core.delete_forum_content_before_query', compact($vars))); + foreach ($table_ary as $table) { $db->sql_query("DELETE FROM $table WHERE forum_id = $forum_id"); From ce937346f30c09b919b056ff72f2ac8813a6c292 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 22 Jul 2015 09:29:22 +0200 Subject: [PATCH 2/3] [ticket/13311] Update @since to 3.1.6-RC1 PHPBB3-13311 --- phpBB/includes/acp/acp_forums.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index d457c5dd70..71953e7d8f 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -1926,7 +1926,7 @@ class acp_forums * @var int forum_id the forum id * @var array topic_ids Array of the topic ids from the forum to be deleted * @var array post_counts Array of counts of posts in the forum, by poster_id - * @since 3.1.5-RC1 + * @since 3.1.6-RC1 */ $vars = array( 'table_ary', From 23aed664732e3e21ca6be4ec727bd173e5278add Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 22 Jul 2015 09:54:28 +0200 Subject: [PATCH 3/3] [ticket/13311] Remove whitespace at end of line PHPBB3-13311 --- phpBB/includes/acp/acp_forums.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 71953e7d8f..7e664c6263 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -1924,7 +1924,7 @@ class acp_forums * @event core.delete_forum_content_before_query * @var array table_ary Array of tables from which all rows will be deleted that hold the forum_id * @var int forum_id the forum id - * @var array topic_ids Array of the topic ids from the forum to be deleted + * @var array topic_ids Array of the topic ids from the forum to be deleted * @var array post_counts Array of counts of posts in the forum, by poster_id * @since 3.1.6-RC1 */