$method = optional_param('method', '', PARAM_ACTION);
$backup_unique_code = optional_param('backup_unique_code',0,PARAM_INT);
- //Get and check course
- if (! $course = $DB->get_record("course", array("id"=>$id))) {
- print_error('invalidcourseid');
- }
- // To some reasons, course_startdateoffset value was lost during restoring
- // See MDL-17469
- if (!empty($course->startdate) && !empty($SESSION->course_header->course_startdate)) {
- $SESSION->restore->course_startdateoffset = $course->startdate - $SESSION->course_header->course_startdate;
- } else {
- $SESSION->restore->course_startdateoffset = 0;
- }
-
//Check login
require_login();
exit;
}
- //We are here, so me have a file.
+ //We are here, so we have a file.
+
+ //Get and check course
+ if (! $course = $DB->get_record('course', array('id'=>$id))) {
+ error("Course ID was incorrect (can't find it)");
+ }
//Print header
if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {