diff options
Diffstat (limited to 'phpBB/includes/acp/acp_forums.php')
-rw-r--r-- | phpBB/includes/acp/acp_forums.php | 49 |
1 files changed, 41 insertions, 8 deletions
diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 0ba1c0c9fd..dd9ff37773 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -950,17 +950,21 @@ class acp_forums $errors = array(); + $forum_data_ary = $forum_data; /** * Validate the forum data before we create/update the forum * * @event core.acp_manage_forums_validate_data - * @var array forum_data Array with new forum data + * @var array forum_data_ary Array with new forum data * @var array errors Array of errors, should be strings and not * language key. * @since 3.1.0-a1 + * @change 3.2.0-a1 Replaced forum_data with forum_data_ary */ - $vars = array('forum_data', 'errors'); + $vars = array('forum_data_ary', 'errors'); extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_validate_data', compact($vars))); + $forum_data = $forum_data_ary; + unset($forum_data_ary); if ($forum_data['forum_name'] == '') { @@ -1058,18 +1062,22 @@ class acp_forums } unset($forum_data_sql['forum_password_unset']); + $forum_data_ary = $forum_data; /** * Remove invalid values from forum_data_sql that should not be updated * * @event core.acp_manage_forums_update_data_before - * @var array forum_data Array with forum data + * @var array forum_data_ary Array with forum data * @var array forum_data_sql Array with data we are going to update * If forum_data_sql[forum_id] is set, we update * that forum, otherwise a new one is created. * @since 3.1.0-a1 + * @change 3.2.0-a1 Replaced forum_data by forum_data_ary */ - $vars = array('forum_data', 'forum_data_sql'); + $vars = array('forum_data_ary', 'forum_data_sql'); extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_update_data_before', compact($vars))); + $forum_data = $forum_data_ary; + unset($forum_data_ary); $is_new_forum = !isset($forum_data_sql['forum_id']); @@ -1348,11 +1356,12 @@ class acp_forums $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_EDIT', false, array($forum_data['forum_name'])); } + $forum_data_ary = $forum_data; /** * Event after a forum was updated or created * * @event core.acp_manage_forums_update_data_after - * @var array forum_data Array with forum data + * @var array forum_data_ary Array with forum data * @var array forum_data_sql Array with data we updated * @var bool is_new_forum Did we create a forum or update one * If you want to overwrite this value, @@ -1360,9 +1369,12 @@ class acp_forums * @var array errors Array of errors, should be strings and not * language key. * @since 3.1.0-a1 + * @change 3.2.0-a1 Replaced forum_data with forum_data_ary */ - $vars = array('forum_data', 'forum_data_sql', 'is_new_forum', 'errors'); + $vars = array('forum_data_ary', 'forum_data_sql', 'is_new_forum', 'errors'); extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_update_data_after', compact($vars))); + $forum_data = $forum_data_ary; + unset($forum_data_ary); return $errors; } @@ -1788,7 +1800,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_container, $phpbb_dispatcher; include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); @@ -1809,7 +1821,10 @@ class acp_forums } $db->sql_freeresult($result); - delete_attachments('topic', $topic_ids, false); + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $attachment_manager->delete('topic', $topic_ids, false); + unset($attachment_manager); // Delete shadow topics pointing to topics in this forum delete_topic_shadows($forum_id); @@ -1920,6 +1935,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.6-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"); |