diff options
author | Bharat Mediratta <bharat@menalto.com> | 2010-01-18 21:40:00 -0800 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-01-18 21:40:00 -0800 |
commit | efa4e230da33e1bf28ebf77e4d1e1b4f293117b1 (patch) | |
tree | 07c7a2165eae12247e088d17b81c72f44775ca38 /modules/gallery/libraries/ORM_MPTT.php | |
parent | b4e6834a28e557c3143f5f3cc91144d1565c18f0 (diff) |
in move_to(), move the lock to before we do any calculations so that we have the latest data.
Diffstat (limited to 'modules/gallery/libraries/ORM_MPTT.php')
-rw-r--r-- | modules/gallery/libraries/ORM_MPTT.php | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/modules/gallery/libraries/ORM_MPTT.php b/modules/gallery/libraries/ORM_MPTT.php index 404d61ff..53e11ece 100644 --- a/modules/gallery/libraries/ORM_MPTT.php +++ b/modules/gallery/libraries/ORM_MPTT.php @@ -232,6 +232,10 @@ class ORM_MPTT_Core extends ORM { throw new Exception("@todo INVALID_TARGET can't move item inside itself"); } + $this->lock(); + $this->reload(); // Assume that the prior lock holder may have changed this entry + $target->reload(); + $number_to_move = (int)(($this->right_ptr - $this->left_ptr) / 2 + 1); $size_of_hole = $number_to_move * 2; $original_left_ptr = $this->left_ptr; @@ -239,9 +243,6 @@ class ORM_MPTT_Core extends ORM { $target_right_ptr = $target->right_ptr; $level_delta = ($target->level + 1) - $this->level; - $this->lock(); - $this->reload(); // Assume that the prior lock holder may have changed this entry - $target->reload(); try { if ($level_delta) { // Update the levels for the to-be-moved items |