Skip to content

Commit

Permalink
MDL-38345 Prevent undefined CFG leading to DB error.
Browse files Browse the repository at this point in the history
It seems that MDL-32975, no matter a version bump
was done, leads to the $CFG->navsortmycoursessort
setting undefined sometimes. And that ends with an error
visiting the /my page. This just ensures a safe default
if the setting is undefined/empty.
  • Loading branch information
stronk7 committed Mar 7, 2013
1 parent ac5fc59 commit a75dfd6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/navigationlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2584,6 +2584,10 @@ public function find($key, $type) {
protected function load_courses_enrolled() {
global $CFG, $DB;
$sortorder = 'visible DESC';
// Prevent undefined $CFG->navsortmycoursessort errors.
if (empty($CFG->navsortmycoursessort)) {
$CFG->navsortmycoursessort = 'sortorder';
}
// Append the chosen sortorder.
$sortorder = $sortorder . ',' . $CFG->navsortmycoursessort . ' ASC';
$courses = enrol_get_my_courses(null, $sortorder);
Expand Down

0 comments on commit a75dfd6

Please sign in to comment.