MDL-35089 conditionals: detected one place missing sectioncache
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Mon, 27 Aug 2012 23:38:09 +0000 (01:38 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Mon, 27 Aug 2012 23:41:41 +0000 (01:41 +0200)
Thanks to MDL-34936 and unit tests this was discovered like 2 new
places calling to get_fast_modinfo() without the sectioncache
column contents. Potential performance problem, leading to
reseting and recalculation of caches all the time.

lib/conditionlib.php

index 0d8b3cb..550d49a 100644 (file)
@@ -596,7 +596,7 @@ abstract class condition_info_base {
                 $course = $COURSE;
             } else {
                 $course = $DB->get_record('course', array('id' => $this->item->course),
                 $course = $COURSE;
             } else {
                 $course = $DB->get_record('course', array('id' => $this->item->course),
-                        'id, enablecompletion, modinfo', MUST_EXIST);
+                        'id, enablecompletion, modinfo, sectioncache', MUST_EXIST);
             }
             foreach ($this->item->conditionscompletion as $cmid => $expectedcompletion) {
                 if (!$modinfo) {
             }
             foreach ($this->item->conditionscompletion as $cmid => $expectedcompletion) {
                 if (!$modinfo) {
@@ -747,7 +747,7 @@ abstract class condition_info_base {
                 $course = $COURSE;
             } else {
                 $course = $DB->get_record('course', array('id' => $this->item->course),
                 $course = $COURSE;
             } else {
                 $course = $DB->get_record('course', array('id' => $this->item->course),
-                        'id, enablecompletion, modinfo', MUST_EXIST);
+                        'id, enablecompletion, modinfo, sectioncache', MUST_EXIST);
             }
 
             $completion = new completion_info($course);
             }
 
             $completion = new completion_info($course);