mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 22:10:45 +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'] . '_';
|
||||
$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'];
|
||||
|
||||
// Adjust destination path (no trailing slash)
|
||||
@@ -177,6 +186,7 @@ class upload extends \phpbb\avatar\driver\driver
|
||||
$file->move_file($destination, true);
|
||||
}
|
||||
|
||||
// If there was an error during move, then clean up leftovers
|
||||
$error = array_merge($error, $file->error);
|
||||
if (sizeof($error))
|
||||
{
|
||||
|
Reference in New Issue
Block a user