Permalink
Browse files

MDL-38345 Prevent undefined CFG leading to DB error.

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...
1 parent 67c8584 commit 5ac03639ca8fd774e77670276f914115a32447e7 @stronk7 stronk7 committed Mar 7, 2013
Showing with 4 additions and 0 deletions.
  1. +4 −0 lib/navigationlib.php
View
@@ -2653,6 +2653,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);

0 comments on commit 5ac0363

Please sign in to comment.