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:
Mark Nielsen
2013-08-29 08:48:39 -07:00
parent abb767192f
commit 0fc55f1d0a
6 changed files with 46 additions and 5 deletions
+5 -1
View File
@@ -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);