From 13df5aeef3b44cb074ab16c94b5d6644d7f565e4 Mon Sep 17 00:00:00 2001 From: moodler Date: Wed, 23 Apr 2003 17:02:24 +0000 Subject: [PATCH] Rebuild course modinfo caches to include the visible variable --- lib/db/mysql.php | 14 ++++++++++++++ lib/db/postgres7.php | 13 +++++++++++++ version.php | 2 +- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/lib/db/mysql.php b/lib/db/mysql.php index 009b217788..8d099c95f9 100644 --- a/lib/db/mysql.php +++ b/lib/db/mysql.php @@ -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; } diff --git a/lib/db/postgres7.php b/lib/db/postgres7.php index 884955192a..9a4c423b5d 100644 --- a/lib/db/postgres7.php +++ b/lib/db/postgres7.php @@ -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; } diff --git a/version.php b/version.php index efb6c3ff65..184657ec1b 100644 --- a/version.php +++ b/version.php @@ -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 -- 2.39.5