MDL-35339 call rebuild_course_cache() always (and only) after changing course modules or sections

This commit is contained in:
Marina Glancy
2012-10-15 14:08:14 +08:00
parent 384c3510a9
commit 38b19bbca1
8 changed files with 45 additions and 42 deletions
+4 -3
View File
@@ -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.