Merge branch 'wip-MDL-41222-m25' of git://github.com/marinaglancy/moodle into MOODLE_25_STABLE
This commit is contained in:
+5
-9
@@ -244,6 +244,10 @@ class course_modinfo extends stdClass {
|
||||
public function __construct($course, $userid) {
|
||||
global $CFG, $DB, $COURSE, $SITE;
|
||||
|
||||
if (!isset($course->modinfo) || !isset($course->sectioncache)) {
|
||||
$course = get_course($course->id, false);
|
||||
}
|
||||
|
||||
// Check modinfo field is set. If not, build and load it.
|
||||
if (empty($course->modinfo) || empty($course->sectioncache)) {
|
||||
rebuild_course_cache($course->id);
|
||||
@@ -1388,7 +1392,7 @@ function get_fast_modinfo($courseorid, $userid = 0, $resetonly = false) {
|
||||
if (is_object($courseorid)) {
|
||||
$course = $courseorid;
|
||||
} else {
|
||||
$course = (object)array('id' => $courseorid, 'modinfo' => null, 'sectioncache' => null);
|
||||
$course = (object)array('id' => $courseorid);
|
||||
}
|
||||
|
||||
// Function is called with $reset = true
|
||||
@@ -1419,14 +1423,6 @@ function get_fast_modinfo($courseorid, $userid = 0, $resetonly = false) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!property_exists($course, 'modinfo')) {
|
||||
debugging('Coding problem - missing course modinfo property in get_fast_modinfo() call');
|
||||
}
|
||||
|
||||
if (!property_exists($course, 'sectioncache')) {
|
||||
debugging('Coding problem - missing course sectioncache property in get_fast_modinfo() call');
|
||||
}
|
||||
|
||||
unset($cache[$course->id]); // prevent potential reference problems when switching users
|
||||
|
||||
$cache[$course->id] = new course_modinfo($course, $userid);
|
||||
|
||||
Reference in New Issue
Block a user