mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 18:06:51 +02:00
MDL-35339 deprecate get_course_section() replace with course_create_sections_if_missing()
By passing course object instead of course id we ensure proper cache reset"
This commit is contained in:
parent
9796014660
commit
4ede27b253
9 changed files with 76 additions and 45 deletions
|
@ -45,12 +45,7 @@ if (($marker >=0) && has_capability('moodle/course:setcurrentsection', $context)
|
|||
}
|
||||
|
||||
// make sure all sections are created
|
||||
$modinfo = get_fast_modinfo($course);
|
||||
for ($sectionnum = 0; $sectionnum <= $course->numsections; $sectionnum++) {
|
||||
if (!$modinfo->get_section_info($sectionnum)) {
|
||||
get_course_section($sectionnum, $course->id);
|
||||
}
|
||||
}
|
||||
course_create_sections_if_missing($course, range(0, $course->numsections));
|
||||
|
||||
$renderer = $PAGE->get_renderer('format_topics');
|
||||
|
||||
|
|
|
@ -38,12 +38,7 @@ if ($week = optional_param('week', 0, PARAM_INT)) {
|
|||
// End backwards-compatible aliasing..
|
||||
|
||||
// make sure all sections are created
|
||||
$modinfo = get_fast_modinfo($course);
|
||||
for ($sectionnum = 0; $sectionnum <= $course->numsections; $sectionnum++) {
|
||||
if (!$modinfo->get_section_info($sectionnum)) {
|
||||
get_course_section($sectionnum, $course->id);
|
||||
}
|
||||
}
|
||||
course_create_sections_if_missing($course, range(0, $course->numsections));
|
||||
|
||||
$renderer = $PAGE->get_renderer('format_weeks');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue