class delete

Attachment delete class

Properties

protected config $config
protected driver_interface $db
protected dispatcher $dispatcher
protected filesystem $filesystem
protected resync $resync
protected string $phpbb_root_path
protected array $ids

Methods

__construct(config $config, driver_interface $db, dispatcher $dispatcher, filesystem $filesystem, resync $resync, string $phpbb_root_path)

Attachment delete class constructor

int|bool
delete(string $mode, mixed $ids, bool $resync = true)

Delete Attachments

bool
set_attachment_ids(mixed $ids)

Set attachment IDs

collect_attachment_info(bool $resync)

Collect info about attachment IDs

delete_attachments_from_db($mode, $ids, $resync)

Delete attachments from database table

remove_from_filesystem($mode, $ids, $resync)

Delete attachments from filesystem

bool
unlink_attachment(string $filename, string $mode = 'file', bool $entry_removed = false)

Delete attachment from filesystem

Details

at line 78
__construct(config $config, driver_interface $db, dispatcher $dispatcher, filesystem $filesystem, resync $resync, string $phpbb_root_path)

Attachment delete class constructor

Parameters

config $config
driver_interface $db
dispatcher $dispatcher
filesystem $filesystem
resync $resync
string $phpbb_root_path

at line 98
int|bool delete(string $mode, mixed $ids, bool $resync = true)

Delete Attachments

Parameters

string $mode can be: post|message|topic|attach|user
mixed $ids can be: post_ids, message_ids, topic_ids, attach_ids, user_ids
bool $resync set this to false if you are deleting posts or topics

Return Value

int|bool Number of deleted attachments or false if something went wrong during attachment deletion

at line 215
protected bool set_attachment_ids(mixed $ids)

Set attachment IDs

Parameters

mixed $ids ID or array of IDs

Return Value

bool True if attachment IDs were set, false if not

at line 271
protected collect_attachment_info(bool $resync)

Collect info about attachment IDs

Parameters

bool $resync Whether topics/posts should be resynced after delete

at line 311
protected delete_attachments_from_db($mode, $ids, $resync)

Delete attachments from database table

Parameters

$mode
$ids
$resync

at line 365
protected remove_from_filesystem($mode, $ids, $resync)

Delete attachments from filesystem

Parameters

$mode
$ids
$resync

Delete attachment from filesystem

Parameters

string $filename Filename of attachment
string $mode Delete mode
bool $entry_removed Whether entry was removed. Defaults to false

Return Value

bool True if file was removed, false if not