diff --git a/libraries/joomla/table/nested.php b/libraries/joomla/table/nested.php index 42d0b68569770..4b9132ce0fb15 100644 --- a/libraries/joomla/table/nested.php +++ b/libraries/joomla/table/nested.php @@ -591,18 +591,12 @@ public function delete($pk = null, $children = true) ->where('lft BETWEEN ' . (int) $node->lft . ' AND ' . (int) $node->rgt); $this->_runQuery($query, 'JLIB_DATABASE_ERROR_DELETE_FAILED'); - // Compress the left values. + // Compress the left and right values. $query->clear() ->update($this->_tbl) ->set('lft = lft - ' . (int) $node->width) - ->where('lft > ' . (int) $node->rgt); - $this->_runQuery($query, 'JLIB_DATABASE_ERROR_DELETE_FAILED'); - - // Compress the right values. - $query->clear() - ->update($this->_tbl) ->set('rgt = rgt - ' . (int) $node->width) - ->where('rgt > ' . (int) $node->rgt); + ->where('lft > ' . (int) $node->rgt); $this->_runQuery($query, 'JLIB_DATABASE_ERROR_DELETE_FAILED'); } // Leave the children and move them up a level. @@ -630,18 +624,12 @@ public function delete($pk = null, $children = true) ->where('parent_id = ' . (int) $node->$k); $this->_runQuery($query, 'JLIB_DATABASE_ERROR_DELETE_FAILED'); - // Shift all of the left values that are right of the node. + // Shift all of the left and right values that are right of the node. $query->clear() ->update($this->_tbl) ->set('lft = lft - 2') - ->where('lft > ' . (int) $node->rgt); - $this->_runQuery($query, 'JLIB_DATABASE_ERROR_DELETE_FAILED'); - - // Shift all of the right values that are right of the node. - $query->clear() - ->update($this->_tbl) ->set('rgt = rgt - 2') - ->where('rgt > ' . (int) $node->rgt); + ->where('lft > ' . (int) $node->rgt); $this->_runQuery($query, 'JLIB_DATABASE_ERROR_DELETE_FAILED'); }