diff options
| author | Bharat Mediratta <bharat@menalto.com> | 2008-12-07 09:25:40 +0000 | 
|---|---|---|
| committer | Bharat Mediratta <bharat@menalto.com> | 2008-12-07 09:25:40 +0000 | 
| commit | fef188d787fd07fc47e30bd7be46a8982dd71788 (patch) | |
| tree | fef8cf47661aec6ea76d44504e07dc0631f0017c /core/models/item.php | |
| parent | bf7ab8904aa9ccbb201b1ef9634a8b13834e5f6d (diff) | |
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.
Diffstat (limited to 'core/models/item.php')
| -rw-r--r-- | core/models/item.php | 28 | 
1 files changed, 10 insertions, 18 deletions
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;    }  | 
