From fef188d787fd07fc47e30bd7be46a8982dd71788 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 7 Dec 2008 09:25:40 +0000 Subject: Leave all locking in ORM_MPTT::move_to, don't worry about it in Item_Model::move_to, unless it turns out that we really need to. --- core/models/item.php | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) (limited to 'core/models') diff --git a/core/models/item.php b/core/models/item.php index bb0adc5a..866315f7 100644 --- a/core/models/item.php +++ b/core/models/item.php @@ -60,28 +60,20 @@ class Item_Model extends ORM_MPTT { * @return ORM_MTPP */ function move_to($target) { - $this->lock(); - try { - $original_path = $this->file_path(); - $original_resize_path = $this->resize_path(); - $original_thumbnail_path = $this->thumbnail_path(); + $original_path = $this->file_path(); + $original_resize_path = $this->resize_path(); + $original_thumbnail_path = $this->thumbnail_path(); - parent::move_to($target, true); + parent::move_to($target, true); - 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(); - throw $e; + 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()); } - $this->unlock(); return $this; } -- cgit v1.2.3