mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-02 23:07:39 +02:00
[ticket/13981] Add events to capture avatar deletion or overwriting
An event to capture overwriting, and another to capture deletion. Includes better error processing. PHPBB3-13981
This commit is contained in:
@@ -139,6 +139,15 @@ class upload extends \phpbb\avatar\driver\driver
|
|||||||
$prefix = $this->config['avatar_salt'] . '_';
|
$prefix = $this->config['avatar_salt'] . '_';
|
||||||
$file->clean_filename('avatar', $prefix, $row['id']);
|
$file->clean_filename('avatar', $prefix, $row['id']);
|
||||||
|
|
||||||
|
// If there was an error during upload, then abort operation
|
||||||
|
if (sizeof($file->error))
|
||||||
|
{
|
||||||
|
$file->remove();
|
||||||
|
$error = $file->error;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate new destination
|
||||||
$destination = $this->config['avatar_path'];
|
$destination = $this->config['avatar_path'];
|
||||||
|
|
||||||
// Adjust destination path (no trailing slash)
|
// Adjust destination path (no trailing slash)
|
||||||
@@ -177,6 +186,7 @@ class upload extends \phpbb\avatar\driver\driver
|
|||||||
$file->move_file($destination, true);
|
$file->move_file($destination, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If there was an error during move, then clean up leftovers
|
||||||
$error = array_merge($error, $file->error);
|
$error = array_merge($error, $file->error);
|
||||||
if (sizeof($error))
|
if (sizeof($error))
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user