MDL-40035: Avoid rebuild_course_cache always for empty course

This commit is contained in:
Tony Levi 2013-06-06 14:11:19 +09:30 committed by Marina Glancy
parent a327f25ef1
commit 00726467f6

View file

@ -275,7 +275,7 @@ class course_modinfo extends stdClass {
// Load sectioncache field into memory as PHP object and check it's valid // Load sectioncache field into memory as PHP object and check it's valid
$sectioncache = unserialize($course->sectioncache); $sectioncache = unserialize($course->sectioncache);
if (!is_array($sectioncache) || empty($sectioncache)) { if (!is_array($sectioncache)) {
// hmm, something is wrong - let's fix it // hmm, something is wrong - let's fix it
rebuild_course_cache($course->id); rebuild_course_cache($course->id);
$course->sectioncache = $DB->get_field('course', 'sectioncache', array('id'=>$course->id)); $course->sectioncache = $DB->get_field('course', 'sectioncache', array('id'=>$course->id));