]> git.mjollnir.org Git - moodle.git/commitdiff
Rebuild course modinfo caches to include the visible variable
authormoodler <moodler>
Wed, 23 Apr 2003 17:02:24 +0000 (17:02 +0000)
committermoodler <moodler>
Wed, 23 Apr 2003 17:02:24 +0000 (17:02 +0000)
lib/db/mysql.php
lib/db/postgres7.php
version.php

index 009b217788b3269a355290d25e544ccbe825ccfd..8d099c95f9c45e54441007c23e0d2a4acdee803e 100644 (file)
@@ -286,6 +286,20 @@ function main_upgrade($oldversion=0) {
         }
     }
 
+    if ($oldversion < 2003042400) {
+    // Rebuild all course caches, because of changes to do with visible variable
+        if ($courses = get_records_sql("SELECT * FROM {$CFG->prefix}course")) {
+            require_once("$CFG->dirroot/course/lib.php");
+            foreach ($courses as $course) {
+                $modinfo = serialize(get_array_of_activities($course->id));
+
+                if (!set_field("course", "modinfo", $modinfo, "id", $course->id)) {
+                    notify("Could not cache module information for course '$course->fullname'!");
+                }
+            }
+        }
+    }
+
     return true;
 }
 
index 884955192a3b95313790baa2d14aa473cd4d45a6..9a4c423b5d1a2744dc1f99f0a596384fcef5f274 100644 (file)
@@ -61,6 +61,19 @@ function main_upgrade($oldversion=0) {
         }
     }
 
+    if ($oldversion < 2003042400) {
+    // Rebuild all course caches, because of changes to do with visible variable
+        if ($courses = get_records_sql("SELECT * FROM {$CFG->prefix}course")) {
+            require_once("$CFG->dirroot/course/lib.php");
+            foreach ($courses as $course) {
+                $modinfo = serialize(get_array_of_activities($course->id));
+
+                if (!set_field("course", "modinfo", $modinfo, "id", $course->id)) {
+                    notify("Could not cache module information for course '$course->fullname'!");
+                }
+            }
+        }
+    }
        
     return true;
 }
index efb6c3ff65574d6779d03adfbe5e194358988681..184657ec1b4dee5bbd6f9939405a31f663a236a1 100644 (file)
@@ -5,7 +5,7 @@
 // database to determine whether upgrades should
 // be performed (see lib/db/*.php)
 
-$version = 2003042104;   // The current version is a date (YYYYMMDDXX)
+$version = 2003042400;   // The current version is a date (YYYYMMDDXX)
 
 $release = "1.0.9 development";  // User-friendly version number