From b4f92c7de69466b2d4ec0c41b9b22e4511314a24 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 29 Jan 2009 09:26:39 +0000 Subject: Add delete support as a quick-edit option --- core/models/item.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'core/models') 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(); } /** -- cgit v1.2.3