diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-03-18 22:42:31 +0000 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-03-18 22:42:31 +0000 |
commit | ccb02b001f96f743e73a1b4a31b5e7053814c642 (patch) | |
tree | d3be1f9e360eb02450f0d05f7722c1a1ba050716 /core | |
parent | 6b5d395d593fb9887cd15e37a0c10ee8334935b6 (diff) |
Fix for ticket #155. Delete the item record before unlinking the
files.
Diffstat (limited to 'core')
-rw-r--r-- | core/models/item.php | 20 |
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(); } /** |