summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2008-12-04 00:14:52 +0000
committerTim Almdal <tnalmdal@shaw.ca>2008-12-04 00:14:52 +0000
commit9ae6acdc0ab3f40fa6267161d733e79d4424eb0b (patch)
tree06445794e646c40e587c61bdbe6bd138c39b2217
parente8cf2a3e67428f855eabba72da3de880335cd483 (diff)
Before deleting an item, save the path to the image in the var directory as once the item is deleted, the $item->file_path() is no longer valid.
-rw-r--r--core/models/item.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/models/item.php b/core/models/item.php
index 211459b9..0f6e16e8 100644
--- a/core/models/item.php
+++ b/core/models/item.php
@@ -40,11 +40,12 @@ class Item_Model extends ORM_MPTT {
}
public function delete() {
+ $path = $this->file_path();
parent::delete();
if ($this->is_album()) {
- directory::unlink($this->file_path());
+ dir::unlink($path);
} else {
- unlink($this->file_path());
+ unlink($path);
}
}