Merge branch 'MDL-49174-28' of git://github.com/jleyva/moodle into MOODLE_28_STABLE

This commit is contained in:
Andrew Nicols
2015-02-23 09:36:21 +08:00
+8 -5
View File
@@ -77,11 +77,14 @@ class core_course_external extends external_api {
//retrieve the course
$course = $DB->get_record('course', array('id' => $params['courseid']), '*', MUST_EXIST);
//check course format exist
if (!file_exists($CFG->dirroot . '/course/format/' . $course->format . '/lib.php')) {
throw new moodle_exception('cannotgetcoursecontents', 'webservice', '', null, get_string('courseformatnotfound', 'error', '', $course->format));
} else {
require_once($CFG->dirroot . '/course/format/' . $course->format . '/lib.php');
if ($course->id != SITEID) {
// Check course format exist.
if (!file_exists($CFG->dirroot . '/course/format/' . $course->format . '/lib.php')) {
throw new moodle_exception('cannotgetcoursecontents', 'webservice', '', null,
get_string('courseformatnotfound', 'error', $course->format));
} else {
require_once($CFG->dirroot . '/course/format/' . $course->format . '/lib.php');
}
}
// now security checks