Skip to content

Commit

Permalink
Merged from MOODLE_14_STABLE
Browse files Browse the repository at this point in the history
Fixed upgrade bug that could show up in cases where:

- installations with large numbers of courses in a category AND 'hidden' courses in those categories
- where the database upgrade was performed while NOT in a logged-in-admin session
fix_course_sortorder() would fail to guarantee the uniqueness of course,sortorder and the new unique index on that column would fail  to be created.

Sigh.
  • Loading branch information
martinlanghoff committed Dec 22, 2004
1 parent 6c4149f commit 301045e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/datalib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2308,7 +2308,7 @@ function fix_course_sortorder($categoryid=0, $n=0, $safe=0) {
if ($count && ( $safe
|| ($max-$min+1!=$count)
|| $min < 10 ) ) {
if ($courses = get_courses($categoryid, 'c.sortorder ASC', 'c.id,c.sortorder')) {
if ($courses = get_records_sql("SELECT c.id, c.sortorder FROM {$CFG->prefix}course c WHERE category=$categoryid ORDER BY c.sortorder ASC")) {
begin_sql();

// find the ideal starting point
Expand Down

0 comments on commit 301045e

Please sign in to comment.