summaryrefslogtreecommitdiff
path: root/core/models/item.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/models/item.php')
-rw-r--r--core/models/item.php15
1 files changed, 11 insertions, 4 deletions
diff --git a/core/models/item.php b/core/models/item.php
index e5e8c556..f78d50b3 100644
--- a/core/models/item.php
+++ b/core/models/item.php
@@ -85,16 +85,23 @@ class Item_Model extends ORM_MPTT {
}
public function delete() {
- $path = $this->file_path();
- parent::delete();
+ $original_path = $this->file_path();
+ $original_resize_path = $this->resize_path();
+ $original_thumb_path = $this->thumb_path();
+
// If there is no name, the path is invalid so don't try to delete
if (!empty($this->name)) {
if ($this->is_album()) {
- dir::unlink($path);
+ dir::unlink(dirname($original_path));
+ dir::unlink(dirname($original_resize_path));
+ dir::unlink(dirname($original_thumb_path));
} else {
- unlink($path);
+ unlink($original_path);
+ unlink($original_resize_path);
+ unlink($original_thumb_path);
}
}
+ parent::delete();
}
/**