From 56bd82ccebbdb49fb8adce5b1f1f78e410ae288d Mon Sep 17 00:00:00 2001 From: David Mudrak Date: Sat, 4 Jun 2011 10:11:30 +0200 Subject: [PATCH] MDL-27448 IMS content package converter checks that the manifest file exists --- mod/imscp/backup/moodle1/lib.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mod/imscp/backup/moodle1/lib.php b/mod/imscp/backup/moodle1/lib.php index 710e82dc6b2..33b1dd75530 100644 --- a/mod/imscp/backup/moodle1/lib.php +++ b/mod/imscp/backup/moodle1/lib.php @@ -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); } -} \ No newline at end of file +}