From: martinlanghoff Date: Wed, 19 Sep 2007 07:14:11 +0000 (+0000) Subject: accesslib:content_moved() fix bug in depth handling X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=b4ab7f2ec939441598f5959b39ba7c928ef29585;p=moodle.git accesslib:content_moved() fix bug in depth handling the depth was getting a bit out-of-control when moving up the tree. Fix it... --- diff --git a/lib/accesslib.php b/lib/accesslib.php index d0e226b0ef..4b61c43781 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -4759,8 +4759,8 @@ function context_moved($context, $newparent) { $newpath = $newparent->path . '/' . $context->id; $setdepth = ''; - if ($newparent->depth +1 != $context->depth) { - $setdepth = ", depth= depth + " . ($context->depth - $newparent->depth +1); + if (($newparent->depth +1) != $context->depth) { + $setdepth = ", depth= depth + ({$newparent->depth} - {$context->depth}) + 1"; } $sql = "UPDATE {$CFG->prefix}context SET path='$newpath'