mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00: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:
parent
e0efd5ee57
commit
4b54df8d45
1 changed files with 10 additions and 0 deletions
|
@ -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))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue