MDL-86714 mod_scorm: parse reference file post-restore/import.
Ensure the SCORM reference file is setup and ready to use after restoring from backup file. Additional support for ancient 1.9 backups.
This commit is contained in:
@@ -129,6 +129,9 @@ class moodle1_mod_scorm_handler extends moodle1_mod_handler {
|
||||
$this->fileman->itemid = 0;
|
||||
$this->fileman->migrate_file('course_files/'.$data['reference']);
|
||||
|
||||
// Fix reference (the file area doesn't allow directories), so it can be extracted upon completion.
|
||||
$data['reference'] = basename($data['reference']);
|
||||
|
||||
// start writing scorm.xml
|
||||
$this->open_xml_writer("activities/scorm_{$this->moduleid}/scorm.xml");
|
||||
$this->xmlwriter->begin_tag('activity', array('id' => $instanceid, 'moduleid' => $this->moduleid,
|
||||
|
||||
@@ -189,7 +189,9 @@ class restore_scorm_activity_structure_step extends restore_activity_structure_s
|
||||
}
|
||||
|
||||
protected function after_execute() {
|
||||
global $DB;
|
||||
global $DB, $CFG;
|
||||
|
||||
require_once("{$CFG->dirroot}/mod/scorm/locallib.php");
|
||||
|
||||
// Add scorm related files, no need to match by itemname (just internally handled context)
|
||||
$this->add_related_files('mod_scorm', 'intro', null);
|
||||
@@ -223,5 +225,8 @@ class restore_scorm_activity_structure_step extends restore_activity_structure_s
|
||||
if (!empty($scorm->launch)) {
|
||||
$DB->update_record('scorm', $scorm);
|
||||
}
|
||||
|
||||
// Finish setting up restored SCORM, extracting content, etc.
|
||||
scorm_parse($scorm, false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user