Skip to content
Browse files

MDL-37078: Restore - section restore fails with multiple availability…

… conditions
  • Loading branch information...
1 parent 5fa7d72 commit c520e08653e79db78a96bf223b9e11af848dd151 @sammarshallou sammarshallou committed Dec 12, 2012
Showing with 4 additions and 4 deletions.
  1. +3 −3 backup/moodle2/restore_stepslib.php
  2. +1 −1 lib/conditionlib.php
View
6 backup/moodle2/restore_stepslib.php
@@ -1151,11 +1151,11 @@ public function after_restore() {
$sectionid = $this->get_task()->get_sectionid();
// Get data object for current section availability (if any).
- $data = $DB->get_record('course_sections_availability',
- array('coursesectionid' => $sectionid), 'id, sourcecmid, gradeitemid', IGNORE_MISSING);
+ $records = $DB->get_records('course_sections_availability',
+ array('coursesectionid' => $sectionid), 'id, sourcecmid, gradeitemid');
// If it exists, update mappings.
- if ($data) {
+ foreach ($records as $data) {
// Only update mappings for entries which are created by this restore.
// Otherwise, when you restore to an existing course, it will mess up
// existing section availability entries.
View
2 lib/conditionlib.php
@@ -760,7 +760,7 @@ public function is_available(&$information, $grabthelot=false, $userid=0, $modin
if (empty($modinfo->cms[$cmid])) {
global $PAGE, $UNITTEST;
if (!empty($UNITTEST) || (isset($PAGE) && strpos($PAGE->pagetype, 'course-view-')===0)) {
- debugging("Warning: activity {$this->cm->id} '{$this->cm->name}' has condition " .
+ debugging("Warning: activity {$this->item->id} '{$this->item->name}' has condition " .
"on deleted activity $cmid (to get rid of this message, edit the named activity)");
}
continue;

0 comments on commit c520e08

Please sign in to comment.
Something went wrong with that request. Please try again.