mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
[ticket/13980] Uploaded avatar not removed when new is uploaded
Remove the previously uploaded avatar when a new one with a different extension is uploaded, using existing delete method PHPBB3-13980
This commit is contained in:
parent
352e995674
commit
d0cdc5553a
1 changed files with 2 additions and 5 deletions
|
@ -161,14 +161,11 @@ class upload extends \phpbb\avatar\driver\driver
|
|||
return false;
|
||||
}
|
||||
|
||||
// Delete current avatar if not overwritten
|
||||
$ext = substr(strrchr($row['avatar'], '.'), 1);
|
||||
if ($ext && $ext !== $file->get('extension'))
|
||||
{
|
||||
$filename = $this->phpbb_root_path . $this->config['avatar_path'] . '/' . $this->config['avatar_salt'] . '_' . $row['id'] . '.' . $ext;
|
||||
if (file_exists($filename))
|
||||
{
|
||||
@unlink($filename);
|
||||
}
|
||||
$this->delete($row);
|
||||
}
|
||||
|
||||
return array(
|
||||
|
|
Loading…
Add table
Reference in a new issue