MDL-27448 IMS content package converter checks that the manifest file exists

This commit is contained in:
David Mudrak
2011-06-04 13:24:03 +02:00
parent 5da3af58a0
commit 56bd82cceb
+8 -3
View File
@@ -122,13 +122,18 @@ class moodle1_mod_imscp_handler extends moodle1_mod_handler {
protected function parse_structure($data, $contextid) {
global $CFG;
$temppath = $this->converter->get_tempdir_path();
$manifestfilecontents = file_get_contents($temppath.'/moddata/resource/'.$data['id'].'/imsmanifest.xml');
$manifestfile = $this->converter->get_tempdir_path().'/moddata/resource/'.$data['id'].'/imsmanifest.xml';
if (!file_exists($manifestfile)) {
// todo add to conversion log
return null;
}
$manifestfilecontents = file_get_contents($manifestfile);
if (empty($manifestfilecontents)) {
// todo add to conversion log
return null;
}
require_once($CFG->dirroot.'/mod/imscp/locallib.php');
return imscp_parse_manifestfile($manifestfilecontents);
}
}
}