From d6a49dab9fe04e538550c909c2dd02ee27753d0d Mon Sep 17 00:00:00 2001 From: martinlanghoff Date: Tue, 8 Feb 2005 03:42:20 +0000 Subject: [PATCH] Merged from MOODLE_14_STABLE - fix_course_sortorder() bug #2509 - Should fix overlaps when moving categories with large gaps -- affects only mysql. Prevent from landing even near the newly assigned range during the temporary shift. --- lib/datalib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/datalib.php b/lib/datalib.php index 77aed11611..d5da7e5478 100644 --- a/lib/datalib.php +++ b/lib/datalib.php @@ -2405,7 +2405,7 @@ function fix_course_sortorder($categoryid=0, $n=0, $safe=0) { // if the new sequence overlaps the current sequence, lack of transactions // will stop us -- shift things aside for a moment... if ($safe || ($n >= $min && $n+$count+1 < $min && $CFG->dbtype==='mysql')) { - $shift = $n + $count + 100; + $shift = $max + $n + 1000; execute_sql("UPDATE {$CFG->prefix}course SET sortorder=sortorder+$shift WHERE category=$categoryid", 0); -- 2.39.5