mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08: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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Delete current avatar if not overwritten
|
||||||
$ext = substr(strrchr($row['avatar'], '.'), 1);
|
$ext = substr(strrchr($row['avatar'], '.'), 1);
|
||||||
if ($ext && $ext !== $file->get('extension'))
|
if ($ext && $ext !== $file->get('extension'))
|
||||||
{
|
{
|
||||||
$filename = $this->phpbb_root_path . $this->config['avatar_path'] . '/' . $this->config['avatar_salt'] . '_' . $row['id'] . '.' . $ext;
|
$this->delete($row);
|
||||||
if (file_exists($filename))
|
|
||||||
{
|
|
||||||
@unlink($filename);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
|
|
Loading…
Add table
Reference in a new issue