Merge branch 'w47_MDL-36719_m24_borkedcachingfront' of git://github.com/skodak/moodle
This commit is contained in:
+15
-6
@@ -3390,13 +3390,16 @@ class admin_setting_sitesetcheckbox extends admin_setting_configcheckbox {
|
||||
public function write_setting($data) {
|
||||
global $DB, $SITE;
|
||||
$record = new stdClass();
|
||||
$record->id = SITEID;
|
||||
$record->id = $SITE->id;
|
||||
$record->{$this->name} = ($data == '1' ? 1 : 0);
|
||||
$record->timemodified = time();
|
||||
// update $SITE
|
||||
$SITE->{$this->name} = $data;
|
||||
course_get_format($SITE)->update_course_format_options($record);
|
||||
return ($DB->update_record('course', $record) ? '' : get_string('errorsetting', 'admin'));
|
||||
$DB->update_record('course', $record);
|
||||
// There is something wrong in cache updates somewhere, let's reset everything.
|
||||
format_base::reset_course_cache();
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3450,13 +3453,16 @@ class admin_setting_sitesettext extends admin_setting_configtext {
|
||||
}
|
||||
|
||||
$record = new stdClass();
|
||||
$record->id = SITEID;
|
||||
$record->id = $SITE->id;
|
||||
$record->{$this->name} = $data;
|
||||
$record->timemodified = time();
|
||||
// update $SITE
|
||||
$SITE->{$this->name} = $data;
|
||||
course_get_format($SITE)->update_course_format_options($record);
|
||||
return ($DB->update_record('course', $record) ? '' : get_string('dbupdatefailed', 'error'));
|
||||
$DB->update_record('course', $record);
|
||||
// There is something wrong in cache updates somewhere, let's reset everything.
|
||||
format_base::reset_course_cache();
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3493,12 +3499,15 @@ class admin_setting_special_frontpagedesc extends admin_setting {
|
||||
public function write_setting($data) {
|
||||
global $DB, $SITE;
|
||||
$record = new stdClass();
|
||||
$record->id = SITEID;
|
||||
$record->id = $SITE->id;
|
||||
$record->{$this->name} = $data;
|
||||
$record->timemodified = time();
|
||||
$SITE->{$this->name} = $data;
|
||||
course_get_format($SITE)->update_course_format_options($record);
|
||||
return ($DB->update_record('course', $record) ? '' : get_string('errorsetting', 'admin'));
|
||||
$DB->update_record('course', $record);
|
||||
// There is something wrong in cache updates somewhere, let's reset everything.
|
||||
format_base::reset_course_cache();
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+9
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user