mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
Merge branch 'MDL-39876-master' of git://github.com/sammarshallou/moodle
Conflicts: course/lib.php
This commit is contained in:
commit
6eee89bc8f
191 changed files with 280 additions and 274 deletions
|
@ -247,7 +247,7 @@ class course_modinfo extends stdClass {
|
|||
// Check modinfo field is set. If not, build and load it.
|
||||
if (empty($course->modinfo) || empty($course->sectioncache)) {
|
||||
rebuild_course_cache($course->id);
|
||||
$course = $DB->get_record('course', array('id'=>$course->id), '*', MUST_EXIST);
|
||||
$course = get_course($course->id);
|
||||
}
|
||||
|
||||
// Set initial values
|
||||
|
@ -1468,19 +1468,16 @@ function rebuild_course_cache($courseid=0, $clearonly=false) {
|
|||
if ($clearonly) {
|
||||
if (empty($courseid)) {
|
||||
$DB->execute('UPDATE {course} set modinfo = ?, sectioncache = ?', array(null, null));
|
||||
// Clear the cached globals too.
|
||||
$COURSE->modinfo = null;
|
||||
$COURSE->sectioncache = null;
|
||||
$SITE->modinfo = null;
|
||||
$SITE->sectioncache = null;
|
||||
} else {
|
||||
// Clear both fields in one update
|
||||
$resetobj = (object)array('id' => $courseid, 'modinfo' => null, 'sectioncache' => null);
|
||||
$DB->update_record('course', $resetobj);
|
||||
}
|
||||
// update cached global COURSE too ;-)
|
||||
if ($courseid == $COURSE->id or empty($courseid)) {
|
||||
$COURSE->modinfo = null;
|
||||
$COURSE->sectioncache = null;
|
||||
}
|
||||
if ($courseid == $SITE->id) {
|
||||
$SITE->modinfo = null;
|
||||
$SITE->sectioncache = null;
|
||||
// Update course object including cached globals.
|
||||
update_course_record($resetobj);
|
||||
}
|
||||
// reset the fast modinfo cache
|
||||
get_fast_modinfo($courseid, 0, true);
|
||||
|
@ -1502,16 +1499,9 @@ function rebuild_course_cache($courseid=0, $clearonly=false) {
|
|||
$sectioncache = serialize(course_modinfo::build_section_cache($course->id));
|
||||
$updateobj = (object)array('id' => $course->id,
|
||||
'modinfo' => $modinfo, 'sectioncache' => $sectioncache);
|
||||
$DB->update_record("course", $updateobj);
|
||||
// update cached global COURSE too ;-)
|
||||
if ($course->id == $COURSE->id) {
|
||||
$COURSE->modinfo = $modinfo;
|
||||
$COURSE->sectioncache = $sectioncache;
|
||||
}
|
||||
if ($course->id == $SITE->id) {
|
||||
$SITE->modinfo = $modinfo;
|
||||
$SITE->sectioncache = $sectioncache;
|
||||
}
|
||||
|
||||
// Update course object including cached globals.
|
||||
update_course_record($updateobj);
|
||||
}
|
||||
$rs->close();
|
||||
// reset the fast modinfo cache
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue