From 85d91b6a1bb5e7eb3fdfd1f12281f84b86cf410e Mon Sep 17 00:00:00 2001 From: David Mudrak Date: Sat, 4 Jun 2011 22:11:03 +0200 Subject: [PATCH] MDL-27448 Do not stop conversion because of missing course files --- backup/converter/moodle1/lib.php | 7 ++++++- mod/resource/backup/moodle1/lib.php | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/backup/converter/moodle1/lib.php b/backup/converter/moodle1/lib.php index 6257b60d893c5..30dbb93d9df7a 100644 --- a/backup/converter/moodle1/lib.php +++ b/backup/converter/moodle1/lib.php @@ -550,7 +550,12 @@ public static function migrate_referenced_files($text, moodle1_file_manager $fil $files = self::find_referenced_files($text); if (!empty($files)) { foreach ($files as $file) { - $fileman->migrate_file('course_files'.$file, dirname($file)); + try { + $fileman->migrate_file('course_files'.$file, dirname($file)); + } catch (moodle1_convert_exception $e) { + // file probably does not exist + // todo add to the conversion log + } } $text = self::rewrite_filephp_usage($text, $files); } diff --git a/mod/resource/backup/moodle1/lib.php b/mod/resource/backup/moodle1/lib.php index 1ff189e5a3527..76946ed8aacb8 100644 --- a/mod/resource/backup/moodle1/lib.php +++ b/mod/resource/backup/moodle1/lib.php @@ -182,7 +182,12 @@ public function process_resource(array $data, array $raw) { // convert the referenced file itself as a main file in the content area $this->fileman->filearea = 'content'; $this->fileman->itemid = 0; - $this->fileman->migrate_file('course_files/'.$data['reference'], '/', null, 1); + try { + $this->fileman->migrate_file('course_files/'.$data['reference'], '/', null, 1); + } catch (moodle1_convert_exception $e) { + // the file probably does not exist + // todo add to log + } // write resource.xml $this->open_xml_writer("activities/resource_{$moduleid}/resource.xml");