From 498c722d0f076bbc9152eb171ed4ac8cf4d29002 Mon Sep 17 00:00:00 2001 From: David Mudrak Date: Mon, 11 Jul 2011 12:12:38 +0200 Subject: [PATCH] MDL-28221 resource: improved file not found handling When the referenced file is not found, do not rely on the record in resource_old as the resource can be actually restored from a 1.9 backup. --- mod/resource/locallib.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mod/resource/locallib.php b/mod/resource/locallib.php index 7690c2c8e2f..41b77cc4c9a 100644 --- a/mod/resource/locallib.php +++ b/mod/resource/locallib.php @@ -345,7 +345,11 @@ function resource_print_filenotfound($resource, $cm, $course) { resource_print_header($resource, $cm, $course); resource_print_heading($resource, $cm, $course); resource_print_intro($resource, $cm, $course); - echo $OUTPUT->notification(get_string('notmigrated', 'resource', $resource_old->type)); + if ($resource_old) { + echo $OUTPUT->notification(get_string('notmigrated', 'resource', $resource_old->type)); + } else { + echo $OUTPUT->notification(get_string('filenotfound', 'resource')); + } echo $OUTPUT->footer(); die; }