summaryrefslogtreecommitdiff
path: root/core/models
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2008-12-04 01:12:44 +0000
committerTim Almdal <tnalmdal@shaw.ca>2008-12-04 01:12:44 +0000
commit5c095cbd787bf71e30658536aafdbf8ea837aa1f (patch)
tree670301aa58fca86c16d18f4ea5615fb70e214d73 /core/models
parent9ae6acdc0ab3f40fa6267161d733e79d4424eb0b (diff)
Add unit tests to test growing and contracting the left and right pointers
Added a delete method to ORM_MPTT that contracts the tree when an item is deleted
Diffstat (limited to 'core/models')
-rw-r--r--core/models/item.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/core/models/item.php b/core/models/item.php
index 0f6e16e8..fbaca0e7 100644
--- a/core/models/item.php
+++ b/core/models/item.php
@@ -42,10 +42,13 @@ class Item_Model extends ORM_MPTT {
public function delete() {
$path = $this->file_path();
parent::delete();
- if ($this->is_album()) {
- dir::unlink($path);
- } else {
- unlink($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);
+ } else {
+ unlink($path);
+ }
}
}