From d05e7a05e9d1a785856503ddee8b98649e38a539 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 12 May 2009 23:18:02 +0000 Subject: Fix a bug where deleting an album sometimes deletes everything in var. Fixes ticket #282 --- core/libraries/ORM_MPTT.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/libraries/ORM_MPTT.php b/core/libraries/ORM_MPTT.php index f64ec200..f263d64a 100644 --- a/core/libraries/ORM_MPTT.php +++ b/core/libraries/ORM_MPTT.php @@ -80,7 +80,10 @@ class ORM_MPTT_Core extends ORM { $children = $this->children(); if ($children) { foreach ($this->children() as $item) { - $item->delete(); + // Deleting children affects the MPTT tree, so we have to reload each child before we + // delete it so that we have current left/right pointers. This is inefficient. + // @todo load each child once, not twice. + $item->reload()->delete(); } // Deleting children has affected this item -- cgit v1.2.3