MDL-33915 - prevent use of rebuild_course_cache during upgrade
authorDan Poltawski <dan@moodle.com>
Thu, 21 Jun 2012 02:49:17 +0000 (10:49 +0800)
committerDan Poltawski <dan@moodle.com>
Thu, 21 Jun 2012 03:43:54 +0000 (11:43 +0800)
It depends on upgrade changes itself

lib/db/upgrade.php

index 09f3896..931c044 100644 (file)
@@ -385,7 +385,9 @@ function xmldb_main_upgrade($oldversion) {
                         AND older.id < cs.id');
         foreach ($rs as $rec) {
             $DB->delete_records('course_sections', array('id' => $rec->id));
-            rebuild_course_cache($rec->course, true);
+            // We can't use rebuild_course_cache() here because introducing sectioncache later
+            // so reset modinfo manually.
+            $DB->set_field('course', 'modinfo', null, array('id' => $rec->course));
         }
         $rs->close();
         $transaction->allow_commit();