Skip to content

Commit

Permalink
MDL-27448 Do not stop conversion because of missing course files
Browse files Browse the repository at this point in the history
  • Loading branch information
mudrd8mz committed Jun 4, 2011
1 parent baa44e3 commit 85d91b6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion backup/converter/moodle1/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
7 changes: 6 additions & 1 deletion mod/resource/backup/moodle1/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 85d91b6

Please sign in to comment.