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.
This commit is contained in:
David Mudrak 2011-07-11 12:12:38 +02:00
parent c6c9a3bcdb
commit 498c722d0f

View File

@ -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;
}