From 98ebbbdca2b7a57136745354b204d9aef181df4a Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 23 Sep 2015 10:43:33 +0200 Subject: [ticket/14168] No longer use deprecated functions in core files PHPBB3-14168 --- phpBB/includes/acp/acp_attachments.php | 10 +++++++--- phpBB/includes/acp/acp_forums.php | 7 +++++-- phpBB/includes/acp/acp_users.php | 10 ++++++++-- 3 files changed, 20 insertions(+), 7 deletions(-) (limited to 'phpBB/includes/acp') diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php index 7ff9846a75..49b8ea462c 100644 --- a/phpBB/includes/acp/acp_attachments.php +++ b/phpBB/includes/acp/acp_attachments.php @@ -39,6 +39,9 @@ class acp_attachments /** @var \phpbb\filesystem\filesystem_interface */ protected $filesystem; + /** @var \phpbb\attachment\delete */ + protected $attachment_delete; + public $id; public $u_action; protected $new_config; @@ -55,6 +58,7 @@ class acp_attachments $this->user = $user; $this->phpbb_container = $phpbb_container; $this->filesystem = $phpbb_filesystem; + $this->attachment_delete = $phpbb_container->get('attachment.delete'); $user->add_lang(array('posting', 'viewtopic', 'acp/attachments')); @@ -922,11 +926,11 @@ class acp_attachments $delete_files = array(); while ($row = $db->sql_fetchrow($result)) { - phpbb_unlink($row['physical_filename'], 'file'); + $this->attachment_delete->unlink_attachment($row['physical_filename'], 'file'); if ($row['thumbnail']) { - phpbb_unlink($row['physical_filename'], 'thumbnail'); + $this->attachment_delete->unlink_attachment($row['physical_filename'], 'thumbnail'); } $delete_files[$row['attach_id']] = $row['real_filename']; @@ -1091,7 +1095,7 @@ class acp_attachments } $db->sql_freeresult($result); - if ($num_deleted = delete_attachments('attach', $delete_files)) + if ($num_deleted = $this->attachment_delete->delete('attach', $delete_files)) { if (sizeof($delete_files) != $num_deleted) { diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index f252f2a594..905a885a56 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -1788,7 +1788,7 @@ class acp_forums */ function delete_forum_content($forum_id) { - global $db, $config, $phpbb_root_path, $phpEx, $phpbb_dispatcher; + global $db, $config, $phpbb_root_path, $phpEx, $phpbb_container, $phpbb_dispatcher; include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); @@ -1809,7 +1809,10 @@ class acp_forums } $db->sql_freeresult($result); - delete_attachments('topic', $topic_ids, false); + /** @var \phpbb\attachment\delete $attachment_delete */ + $attachment_delete = $phpbb_container->get('attachment.delete'); + $attachment_delete->delete('topic', $topic_ids, false); + unset($attachment_delete); // Delete shadow topics pointing to topics in this forum delete_topic_shadows($forum_id); diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 857c625867..ab0eda507e 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -543,7 +543,10 @@ class acp_users if (confirm_box(true)) { - delete_attachments('user', $user_id); + /** @var \phpbb\attachment\delete $attachment_delete */ + $attachment_delete = $phpbb_container->get('attachment.delete'); + $attachment_delete->delete('user', $user_id); + unset($attachment_delete); $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_ATTACH', false, array($user_row['username'])); trigger_error($user->lang['USER_ATTACHMENTS_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id)); @@ -2126,7 +2129,10 @@ class acp_users } $db->sql_freeresult($result); - delete_attachments('attach', $marked); + /** @var \phpbb\attachment\delete $attachment_delete */ + $attachment_delete = $phpbb_container->get('attachment.delete'); + $attachment_delete->delete('attach', $marked); + unset($attachment_delete); $message = (sizeof($log_attachments) == 1) ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED']; -- cgit v1.2.1 From 49312f05f88ca58346cbb00c2f03f01fd2a3d56d Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 12 Oct 2015 11:34:11 +0200 Subject: [ticket/14168] Use attachment manager instead of separate classes PHPBB3-14168 --- phpBB/includes/acp/acp_attachments.php | 12 ++++++------ phpBB/includes/acp/acp_forums.php | 8 ++++---- phpBB/includes/acp/acp_users.php | 16 ++++++++-------- 3 files changed, 18 insertions(+), 18 deletions(-) (limited to 'phpBB/includes/acp') diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php index 49b8ea462c..e2090f3cd5 100644 --- a/phpBB/includes/acp/acp_attachments.php +++ b/phpBB/includes/acp/acp_attachments.php @@ -39,8 +39,8 @@ class acp_attachments /** @var \phpbb\filesystem\filesystem_interface */ protected $filesystem; - /** @var \phpbb\attachment\delete */ - protected $attachment_delete; + /** @var \phpbb\attachment\manager */ + protected $attachment_manager; public $id; public $u_action; @@ -58,7 +58,7 @@ class acp_attachments $this->user = $user; $this->phpbb_container = $phpbb_container; $this->filesystem = $phpbb_filesystem; - $this->attachment_delete = $phpbb_container->get('attachment.delete'); + $this->attachment_manager = $phpbb_container->get('attachment.manager'); $user->add_lang(array('posting', 'viewtopic', 'acp/attachments')); @@ -926,11 +926,11 @@ class acp_attachments $delete_files = array(); while ($row = $db->sql_fetchrow($result)) { - $this->attachment_delete->unlink_attachment($row['physical_filename'], 'file'); + $this->attachment_manager->unlink($row['physical_filename'], 'file'); if ($row['thumbnail']) { - $this->attachment_delete->unlink_attachment($row['physical_filename'], 'thumbnail'); + $this->attachment_manager->unlink($row['physical_filename'], 'thumbnail'); } $delete_files[$row['attach_id']] = $row['real_filename']; @@ -1095,7 +1095,7 @@ class acp_attachments } $db->sql_freeresult($result); - if ($num_deleted = $this->attachment_delete->delete('attach', $delete_files)) + if ($num_deleted = $this->attachment_manager->delete('attach', $delete_files)) { if (sizeof($delete_files) != $num_deleted) { diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 905a885a56..5d20664b31 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -1809,10 +1809,10 @@ class acp_forums } $db->sql_freeresult($result); - /** @var \phpbb\attachment\delete $attachment_delete */ - $attachment_delete = $phpbb_container->get('attachment.delete'); - $attachment_delete->delete('topic', $topic_ids, false); - unset($attachment_delete); + /** @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); diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index ab0eda507e..f26c0d3f93 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -543,10 +543,10 @@ class acp_users if (confirm_box(true)) { - /** @var \phpbb\attachment\delete $attachment_delete */ - $attachment_delete = $phpbb_container->get('attachment.delete'); - $attachment_delete->delete('user', $user_id); - unset($attachment_delete); + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $attachment_manager->delete('user', $user_id); + unset($attachment_manager); $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_ATTACH', false, array($user_row['username'])); trigger_error($user->lang['USER_ATTACHMENTS_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id)); @@ -2129,10 +2129,10 @@ class acp_users } $db->sql_freeresult($result); - /** @var \phpbb\attachment\delete $attachment_delete */ - $attachment_delete = $phpbb_container->get('attachment.delete'); - $attachment_delete->delete('attach', $marked); - unset($attachment_delete); + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $attachment_manager->delete('attach', $marked); + unset($attachment_manager); $message = (sizeof($log_attachments) == 1) ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED']; -- cgit v1.2.1