phpBB

Code Changes

File: phpbb/attachment/delete.php

  Unmodified   Added   Modified   Removed
Line 103Line 103
		}

$this->set_sql_constraints($mode);

		}

$this->set_sql_constraints($mode);

 

$sql_id = $this->sql_id;


/**
* Perform additional actions before collecting data for attachment(s) deletion


/**
* Perform additional actions before collecting data for attachment(s) deletion

Line 121Line 123
			'sql_id',
);
extract($this->dispatcher->trigger_event('core.delete_attachments_collect_data_before', compact($vars)));

			'sql_id',
);
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


// 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


/**
* Perform additional actions after attachment(s) deletion from the database

Line 155Line 167
			'num_deleted',
);
extract($this->dispatcher->trigger_event('core.delete_attachments_from_database_after', compact($vars)));

			'num_deleted',
);
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)
{


if (!$this->num_deleted)
{

Line 162Line 182
		}

// Delete attachments from filesystem

		}

// 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)


// If we do not resync, we do not need to adjust any message, post, topic or user entries
if (!$resync)

Line 288Line 308
	/**
* Delete attachments from database table
*/

	/**
* 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
*

		/**
* Perform additional actions before attachment(s) deletion
*

Line 315Line 341
			'physical',
);
extract($this->dispatcher->trigger_event('core.delete_attachments_before', compact($vars)));

			'physical',
);
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 . '


// Delete attachments
$sql = 'DELETE FROM ' . ATTACHMENTS_TABLE . '

Line 329Line 362
	/**
* Delete attachments from filesystem
*/

	/**
* Delete attachments from filesystem
*/

	protected function remove_from_filesystem()

	protected function remove_from_filesystem($mode, $ids, $resync)

	{
$space_removed = $files_removed = 0;


	{
$space_removed = $files_removed = 0;


Line 347Line 380
				$this->unlink_attachment($file_ary['filename'], 'thumbnail', true);
}
}

				$this->unlink_attachment($file_ary['filename'], 'thumbnail', true);
}
}

 

$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


/**
* Perform additional actions after attachment(s) deletion from the filesystem

Line 379Line 419
			'files_removed',
);
extract($this->dispatcher->trigger_event('core.delete_attachments_from_filesystem_after', compact($vars)));

			'files_removed',
);
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)
{


if ($space_removed || $files_removed)
{