1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 05:50:42 +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:
javiexin
2015-07-09 16:33:56 +02:00
parent e0efd5ee57
commit 4b54df8d45

View File

@@ -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))
{