MDL-36719 update $SITE caches in rebuild_course_cache()

This commit is contained in:
Petr Škoda
2012-11-20 15:39:43 +01:00
parent 40b9c0694c
commit e271f71da4
+9 -1
View File
@@ -1358,7 +1358,7 @@ function get_fast_modinfo($courseorid, $userid = 0, $resetonly = false) {
* @param boolean $clearonly - only clear the modinfo fields, gets rebuild automatically on the fly
*/
function rebuild_course_cache($courseid=0, $clearonly=false) {
global $COURSE, $DB, $CFG;
global $COURSE, $SITE, $DB, $CFG;
// Destroy navigation caches
navigation_cache::destroy_volatile_caches();
@@ -1382,6 +1382,10 @@ function rebuild_course_cache($courseid=0, $clearonly=false) {
$COURSE->modinfo = null;
$COURSE->sectioncache = null;
}
if ($courseid == $SITE->id) {
$SITE->modinfo = null;
$SITE->sectioncache = null;
}
// reset the fast modinfo cache
get_fast_modinfo($courseid, 0, true);
return;
@@ -1408,6 +1412,10 @@ function rebuild_course_cache($courseid=0, $clearonly=false) {
$COURSE->modinfo = $modinfo;
$COURSE->sectioncache = $sectioncache;
}
if ($course->id == $SITE->id) {
$SITE->modinfo = $modinfo;
$SITE->sectioncache = $sectioncache;
}
}
$rs->close();
// reset the fast modinfo cache