]> git.mjollnir.org Git - moodle.git/commitdiff
Merged from MOODLE_14_HEAD - Better behaviour of fix_course_sortorder() -- related...
authormartinlanghoff <martinlanghoff>
Tue, 1 Feb 2005 01:37:14 +0000 (01:37 +0000)
committermartinlanghoff <martinlanghoff>
Tue, 1 Feb 2005 01:37:14 +0000 (01:37 +0000)
lib/datalib.php

index 292fbcb85594da83dfc41aeb187a77cffed66309..4f848b127c8453f32c766a17aff99e8187910053 100644 (file)
@@ -2402,7 +2402,7 @@ function fix_course_sortorder($categoryid=0, $n=0, $safe=0) {
             $n = $n + $catgap;             
             // if the new sequence overlaps the current sequence, lack of transactions
             // will stop us -- shift things aside for a moment...
-            if ($n >= $min && $n+$count+1 < $min && $CFG->dbtype==='mysql') {
+            if ($safe || ($n >= $min && $n+$count+1 < $min && $CFG->dbtype==='mysql')) {
                 $shift = $n + $count + 100;
                 execute_sql("UPDATE {$CFG->prefix}course 
                          SET sortorder=sortorder+$shift 
@@ -2427,7 +2427,7 @@ function fix_course_sortorder($categoryid=0, $n=0, $safe=0) {
 
     if ($categories = get_categories($categoryid)) {
         foreach ($categories as $category) {
-            $n = fix_course_sortorder($category->id, $n);
+            $n = fix_course_sortorder($category->id, $n, $safe);
         }
     }