diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-01-29 09:26:39 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-01-29 09:26:39 +0000 |
commit | b4f92c7de69466b2d4ec0c41b9b22e4511314a24 (patch) | |
tree | fa174f59d2cfaaf993600735f57053ba0b059ec4 /core/models | |
parent | 6091350c9454c92e5a975901eff8f5f46bee3045 (diff) |
Add delete support as a quick-edit option
Diffstat (limited to 'core/models')
-rw-r--r-- | core/models/item.php | 15 |
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(); } /** |