From 6c1a52e67cf300fc5f539a7c860cc5615679f7ef Mon Sep 17 00:00:00 2001 From: Juan Leyva Date: Wed, 11 Feb 2015 12:39:23 +0100 Subject: [PATCH] MDL-49174 webservices: Return front page contents in get_contents ws --- course/externallib.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/course/externallib.php b/course/externallib.php index 4d8c7e8cc70..aea77f7817d 100644 --- a/course/externallib.php +++ b/course/externallib.php @@ -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