Permalink
Browse files

MDL-31532 restore: avoid null course->hiddensections problems. Credit…

… goes to Petri Asikainen. Thanks!
  • Loading branch information...
1 parent ad52027 commit 47ac7c3668243e4a638da5153796f61ecbcaab81 @stronk7 stronk7 committed Feb 20, 2012
Showing with 6 additions and 0 deletions.
  1. +6 −0 backup/moodle2/restore_stepslib.php
@@ -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';

0 comments on commit 47ac7c3

Please sign in to comment.