aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2018-10-20 12:14:48 -0400
committerMarc Alexander <admin@m-a-styles.de>2018-10-20 12:14:48 -0400
commite2a6a7e83a0e98c1e2d1fdced270d760b928bc20 (patch)
tree64c436efbe8fce7ce51bfe592b83b58b9410e898 /phpBB
parent7aa639f050833a6e563a9c13ae19f831988555fc (diff)
parentfc674873c7ad0acaf7773003534fd2279a4dd1bf (diff)
downloadforums-e2a6a7e83a0e98c1e2d1fdced270d760b928bc20.tar
forums-e2a6a7e83a0e98c1e2d1fdced270d760b928bc20.tar.gz
forums-e2a6a7e83a0e98c1e2d1fdced270d760b928bc20.tar.bz2
forums-e2a6a7e83a0e98c1e2d1fdced270d760b928bc20.tar.xz
forums-e2a6a7e83a0e98c1e2d1fdced270d760b928bc20.zip
Merge pull request #5320 from rxu/ticket/15755
[ticket/15755] Fix event vars in /phpbb/attachment/delete.php
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/phpbb/attachment/delete.php56
1 files changed, 52 insertions, 4 deletions
diff --git a/phpBB/phpbb/attachment/delete.php b/phpBB/phpbb/attachment/delete.php
index 922f24b5dc..3c98e21587 100644
--- a/phpBB/phpbb/attachment/delete.php
+++ b/phpBB/phpbb/attachment/delete.php
@@ -104,6 +104,8 @@ class delete
$this->set_sql_constraints($mode);
+ $sql_id = $this->sql_id;
+
/**
* Perform additional actions before collecting data for attachment(s) deletion
*
@@ -122,11 +124,21 @@ class delete
);
extract($this->dispatcher->trigger_event('core.delete_attachments_collect_data_before', compact($vars)));
+ $this->sql_id = $sql_id;
+ unset($sql_id);
+
// Collect post and topic ids for later use if we need to touch remaining entries (if resync is enabled)
$this->collect_attachment_info($resync);
// Delete attachments from database
- $this->delete_attachments_from_db();
+ $this->delete_attachments_from_db($mode, $ids, $resync);
+
+ $sql_id = $this->sql_id;
+ $post_ids = $this->post_ids;
+ $topic_ids = $this->topic_ids;
+ $message_ids = $this->message_ids;
+ $physical = $this->physical;
+ $num_deleted = $this->num_deleted;
/**
* Perform additional actions after attachment(s) deletion from the database
@@ -156,13 +168,21 @@ class delete
);
extract($this->dispatcher->trigger_event('core.delete_attachments_from_database_after', compact($vars)));
+ $this->sql_id = $sql_id;
+ $this->post_ids = $post_ids;
+ $this->topic_ids = $topic_ids;
+ $this->message_ids = $message_ids;
+ $this->physical = $physical;
+ $this->num_deleted = $num_deleted;
+ unset($sql_id, $post_ids, $topic_ids, $message_ids, $physical, $num_deleted);
+
if (!$this->num_deleted)
{
return 0;
}
// Delete attachments from filesystem
- $this->remove_from_filesystem();
+ $this->remove_from_filesystem($mode, $ids, $resync);
// If we do not resync, we do not need to adjust any message, post, topic or user entries
if (!$resync)
@@ -288,8 +308,14 @@ class delete
/**
* Delete attachments from database table
*/
- protected function delete_attachments_from_db()
+ protected function delete_attachments_from_db($mode, $ids, $resync)
{
+ $sql_id = $this->sql_id;
+ $post_ids = $this->post_ids;
+ $topic_ids = $this->topic_ids;
+ $message_ids = $this->message_ids;
+ $physical = $this->physical;
+
/**
* Perform additional actions before attachment(s) deletion
*
@@ -316,6 +342,13 @@ class delete
);
extract($this->dispatcher->trigger_event('core.delete_attachments_before', compact($vars)));
+ $this->sql_id = $sql_id;
+ $this->post_ids = $post_ids;
+ $this->topic_ids = $topic_ids;
+ $this->message_ids = $message_ids;
+ $this->physical = $physical;
+ unset($sql_id, $post_ids, $topic_ids, $message_ids, $physical);
+
// Delete attachments
$sql = 'DELETE FROM ' . ATTACHMENTS_TABLE . '
WHERE ' . $this->db->sql_in_set($this->sql_id, $this->ids);
@@ -329,7 +362,7 @@ class delete
/**
* Delete attachments from filesystem
*/
- protected function remove_from_filesystem()
+ protected function remove_from_filesystem($mode, $ids, $resync)
{
$space_removed = $files_removed = 0;
@@ -348,6 +381,13 @@ class delete
}
}
+ $sql_id = $this->sql_id;
+ $post_ids = $this->post_ids;
+ $topic_ids = $this->topic_ids;
+ $message_ids = $this->message_ids;
+ $physical = $this->physical;
+ $num_deleted = $this->num_deleted;
+
/**
* Perform additional actions after attachment(s) deletion from the filesystem
*
@@ -380,6 +420,14 @@ class delete
);
extract($this->dispatcher->trigger_event('core.delete_attachments_from_filesystem_after', compact($vars)));
+ $this->sql_id = $sql_id;
+ $this->post_ids = $post_ids;
+ $this->topic_ids = $topic_ids;
+ $this->message_ids = $message_ids;
+ $this->physical = $physical;
+ $this->num_deleted = $num_deleted;
+ unset($sql_id, $post_ids, $topic_ids, $message_ids, $physical, $num_deleted);
+
if ($space_removed || $files_removed)
{
$this->config->increment('upload_dir_size', $space_removed * (-1), false);