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.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/models/item.php b/core/models/item.php
index 9d23170f..211459b9 100644
--- a/core/models/item.php
+++ b/core/models/item.php
@@ -39,6 +39,15 @@ class Item_Model extends ORM_MPTT {
return $this->type == 'photo';
}
+ public function delete() {
+ parent::delete();
+ if ($this->is_album()) {
+ directory::unlink($this->file_path());
+ } else {
+ unlink($this->file_path());
+ }
+ }
+
/**
* album: /var/albums/album1/album2
* photo: /var/albums/album1/album2/photo.jpg