summaryrefslogtreecommitdiff
path: root/app/Model/AvatarFile.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Model/AvatarFile.php')
-rw-r--r--app/Model/AvatarFile.php12
1 files changed, 8 insertions, 4 deletions
diff --git a/app/Model/AvatarFile.php b/app/Model/AvatarFile.php
index c49f9fd5..36784e60 100644
--- a/app/Model/AvatarFile.php
+++ b/app/Model/AvatarFile.php
@@ -60,14 +60,18 @@ class AvatarFile extends Base
public function remove($user_id)
{
try {
- $this->objectStorage->remove($this->getFilename($user_id));
- $result = $this->db->table(User::TABLE)->eq('id', $user_id)->update(array('avatar_path' => ''));
- $this->userSession->refresh($user_id);
- return $result;
+ $filename = $this->getFilename($user_id);
+
+ if (! empty($filename)) {
+ $this->objectStorage->remove($filename);
+ return $this->db->table(User::TABLE)->eq('id', $user_id)->update(array('avatar_path' => ''));
+ }
} catch (Exception $e) {
$this->logger->error($e->getMessage());
return false;
}
+
+ return true;
}
/**