Skip to content

Commit

Permalink
MDL-31532 restore: avoid null course->hiddensections problems. Credit…
Browse files Browse the repository at this point in the history
… goes to Petri Asikainen. Thanks!
  • Loading branch information
stronk7 committed Feb 20, 2012
1 parent ad52027 commit 47ac7c3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions backup/moodle2/restore_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,12 @@ public function process_course($data) {
unset($data->idnumber);
}

// Any empty value for course->hiddensections will lead to 0 (default, show collapsed).
// It has been reported that some old 1.9 courses may have it null leading to DB error. MDL-31532
if (empty($data->hiddensections)) {
$data->hiddensections = 0;
}

// Only restrict modules if original course was and target site too for new courses
$data->restrictmodules = $data->restrictmodules && !empty($CFG->restrictmodulesfor) && $CFG->restrictmodulesfor == 'all';

Expand Down

0 comments on commit 47ac7c3

Please sign in to comment.