phpBB API Documentation
Class

phpbb\attachment\manager

class manager

Attachment manager

Methods

__construct(delete $delete, resync $resync, upload $upload)

Constructor for attachment manager

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

Wrapper method for deleting attachments

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

Wrapper method for deleting attachments from filesystem

resync(string $type, array $ids)

Wrapper method for resyncing specified type

array upload(string $form_name, int $forum_id, bool $local = false, string $local_storage = '', bool $is_message = false, array $local_filedata = array())

Wrapper method for uploading attachment

Details

at line 37
public __construct(delete $delete, resync $resync, upload $upload)

Constructor for attachment manager

Parameters

delete $delete Attachment delete class
resync $resync Attachment resync class
upload $upload Attachment upload class

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

Wrapper method for deleting attachments

Parameters

string $mode can be: post|message|topic|attach|user
mixed $ids can be: postids, messageids, topicids, attachids, 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

Wrapper method for deleting attachments 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

at line 78
public resync(string $type, array $ids)

Wrapper method for resyncing specified type

Parameters

string $type Type of resync
array $ids IDs to resync

at line 95
public array upload(string $form_name, int $forum_id, bool $local = false, string $local_storage = '', bool $is_message = false, array $local_filedata = array())

Wrapper method for uploading attachment

Parameters

string $form_name The form name of the file upload input
int $forum_id The id of the forum
bool $local Whether the file is local or not
string $local_storage The path to the local file
bool $is_message Whether it is a PM or not
array $local_filedata An file data object created for the local file

Return Value

array File data array