MDL-19142 assignment/backup: reverting earlier patch while I figure out a better way to deal with course_modules during restore
This commit is contained in:
@@ -105,22 +105,11 @@
|
||||
//We have the newid, update backup_ids
|
||||
backup_putid($restore->backup_unique_code,$mod->modtype,
|
||||
$mod->id, $newid);
|
||||
// load up the subtype and see if it wants anything further restored.
|
||||
$class = 'assignment_' . $assignment->assignmenttype;
|
||||
require_once($CFG->dirroot . '/mod/assignment/lib.php');
|
||||
require_once($CFG->dirroot . '/mod/assignment/type/' . $assignment->assignmenttype . '/assignment.class.php');
|
||||
$cmid = backup_getid($restore->backup_unique_code, 'course_modules', $mod->id);
|
||||
$cm = get_record('course_modules', 'id', $cmid->new_id);
|
||||
$cm->instance = $newid;
|
||||
$subtype = new $class($cmid->id, $assignment, $cm);
|
||||
$assignment->id = $newid;
|
||||
|
||||
$subtype->restore_one_mod($info, $restore);
|
||||
|
||||
//Now check if want to restore user data and do it.
|
||||
if (restore_userdata_selected($restore,'assignment',$mod->id)) {
|
||||
//Restore assignmet_submissions
|
||||
$status = assignment_submissions_restore_mods($mod->id, $newid,$info,$restore, $subtype) && $status;
|
||||
$status = assignment_submissions_restore_mods($mod->id, $newid,$info,$restore) && $status;
|
||||
}
|
||||
} else {
|
||||
$status = false;
|
||||
@@ -133,7 +122,7 @@
|
||||
}
|
||||
|
||||
//This function restores the assignment_submissions
|
||||
function assignment_submissions_restore_mods($old_assignment_id, $new_assignment_id,$info,$restore, $subtype) {
|
||||
function assignment_submissions_restore_mods($old_assignment_id, $new_assignment_id,$info,$restore) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
@@ -211,8 +200,6 @@
|
||||
$status = assignment_restore_files ($old_assignment_id, $new_assignment_id,
|
||||
$olduserid, $submission->userid, $restore);
|
||||
|
||||
$submission->id = $newid;
|
||||
$status = $subtype->restore_one_submission($submission, $info, $restore);
|
||||
} else {
|
||||
$status = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user