summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/models/item.php20
1 files changed, 13 insertions, 7 deletions
diff --git a/core/models/item.php b/core/models/item.php
index 0ca40503..1aa9a9be 100644
--- a/core/models/item.php
+++ b/core/models/item.php
@@ -98,18 +98,24 @@ class Item_Model extends ORM_MPTT {
$original_thumb_path = $this->thumb_path();
// If there is no name, the path is invalid so don't try to delete
+ parent::delete();
if (!empty($this->name)) {
if ($this->is_album()) {
- dir::unlink($original_path);
- dir::unlink($original_resize_path);
- dir::unlink($original_thumb_path);
+ @dir::unlink($original_path);
+ @dir::unlink($original_resize_path);
+ @dir::unlink($original_thumb_path);
} else {
- unlink($original_path);
- unlink($original_resize_path);
- unlink($original_thumb_path);
+ if (file_exists($original_path)) {
+ @unlink($original_path);
+ }
+ if (file_exists($original_resize_path)) {
+ @unlink($original_resize_path);
+ }
+ if (file_exists($original_thumb_path)) {
+ @unlink($original_thumb_path);
+ }
}
}
- parent::delete();
}
/**