MDL-35339 call rebuild_course_cache() always (and only) after changing course modules or sections
This commit is contained in:
@@ -612,14 +612,15 @@ class dndupload_ajax_processor {
|
||||
}
|
||||
|
||||
$DB->set_field('course_modules', 'instance', $instanceid, array('id' => $this->cm->id));
|
||||
// Rebuild the course cache after update action
|
||||
rebuild_course_cache($this->course->id, true);
|
||||
$this->course->modinfo = null; // Otherwise we will just get the old version back again.
|
||||
|
||||
$sectionid = course_add_cm_to_section($this->course, $this->cm->id, $this->section);
|
||||
|
||||
set_coursemodule_visible($this->cm->id, true);
|
||||
|
||||
// Rebuild the course cache and retrieve the final info about this module.
|
||||
rebuild_course_cache($this->course->id, true);
|
||||
$this->course->modinfo = null; // Otherwise we will just get the old version back again.
|
||||
// retrieve the final info about this module.
|
||||
$info = get_fast_modinfo($this->course);
|
||||
if (!isset($info->cms[$this->cm->id])) {
|
||||
// The course module has not been properly created in the course - undo everything.
|
||||
|
||||
Reference in New Issue
Block a user