MDL-32690: Restore 1.9 backup into 2.X fails on missing assignment type
Solution is as follows: * Allow unsupported subplugins to convert from Moodle1 to Moodle2 * On Moodle2 restore hide unsupported subplugins * Graceful error message in assignment of unsupported subplugins
This commit is contained in:
@@ -40,7 +40,11 @@ require_login($course, true, $cm);
|
||||
|
||||
$PAGE->requires->js('/mod/assignment/assignment.js');
|
||||
|
||||
require ("$CFG->dirroot/mod/assignment/type/$assignment->assignmenttype/assignment.class.php");
|
||||
$classfile = "$CFG->dirroot/mod/assignment/type/$assignment->assignmenttype/assignment.class.php";
|
||||
if (!file_exists($classfile)) {
|
||||
throw new moodle_exception('unsupportedsubplugin', 'assignment', new moodle_url('/course/view.php', array('id' => $course->id)), $assignment->assignmenttype);
|
||||
}
|
||||
require ($classfile);
|
||||
$assignmentclass = "assignment_$assignment->assignmenttype";
|
||||
$assignmentinstance = new $assignmentclass($cm->id, $assignment, $cm, $course);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user