Skip to content

Commit

Permalink
MDL-60842 calendar: do not load all course fields
Browse files Browse the repository at this point in the history
  • Loading branch information
lameze committed Nov 20, 2017
1 parent 0164f50 commit 2dc93a3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions calendar/lib.php
Expand Up @@ -2538,7 +2538,7 @@ function calendar_get_allowed_types(&$allowed, $course = null, $groups = null, $

if (!empty($course)) {
if (!is_object($course)) {
$course = $DB->get_record('course', array('id' => $course), '*', MUST_EXIST);
$course = $DB->get_record('course', array('id' => $course), 'id, groupmode, groupmodeforce', MUST_EXIST);
}
if ($course->id != SITEID) {
$coursecontext = \context_course::instance($course->id);
Expand Down Expand Up @@ -2602,7 +2602,7 @@ function calendar_get_all_allowed_types() {
// This function warms the context cache for the course so the calls
// to load the course context in calendar_get_allowed_types don't result
// in additional DB queries.
$courses = calendar_get_default_courses(null, '*', true);
$courses = calendar_get_default_courses(null, 'id, groupmode, groupmodeforce', true);

// We want to pre-fetch all of the groups for each course in a single
// query to avoid calendar_get_allowed_types from hitting the DB for
Expand Down

0 comments on commit 2dc93a3

Please sign in to comment.