From 8d1790a0b465566439911c05806afea742148773 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Fri, 5 Dec 2008 04:56:33 +0000 Subject: * Add a moveTo unit test * Pass the module::event(..., $data) by reference to the handlers --- core/models/item.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'core/models') diff --git a/core/models/item.php b/core/models/item.php index 495508ec..f1a979ee 100644 --- a/core/models/item.php +++ b/core/models/item.php @@ -63,11 +63,18 @@ class Item_Model extends ORM_MPTT { $this->lock(); try { $original_path = $this->file_path(); + $original_resize_path = $this->resize_path(); + $original_thumbnail_path = $this->thumbnail_path(); parent::moveTo($target, true); - $new_path = $this->file_path(); - rename($original_path, $new_path); + rename($original_path, $this->file_path()); + if (file_exists($original_resize_path)) { + rename($original_resize_path, $this->resize_path()); + } + if (file_exists($original_thumbnail_path)) { + rename($original_thumbnail_path, $this->thumbnail_path()); + } } catch (Exception $e) { $this->unlock(); -- cgit v1.2.3