Delete previous avatar when uploading a new one

This commit is contained in:
Toby Zerner 2015-05-06 11:22:35 +09:30
parent 7f828fffbb
commit 9559ac1bb6

View File

@ -47,7 +47,9 @@ class UploadAvatarCommandHandler
'target' => $this->uploadDir,
]);
// @todo delete old avatar
if ($mount->has($file = "target://$user->avatar_path")) {
$mount->delete($file);
}
$user->changeAvatarPath($uploadName);