From 31f0900c61cc57a52f6043c9f0cc35e6a261fdbe Mon Sep 17 00:00:00 2001 From: moodler Date: Sat, 5 Oct 2002 17:09:31 +0000 Subject: [PATCH] Moved upgrade_moodle functions out to database-specific files, because the SQL is not compatible (nor is it possible to make it so). --- admin/index.php | 3 +- lib/db/mysql.php | 81 +++++++++++++++++++++++++++++++++++++++ lib/db/postgres7.php | 25 ++++++++++++ version.php | 90 ++++---------------------------------------- 4 files changed, 115 insertions(+), 84 deletions(-) create mode 100644 lib/db/mysql.php create mode 100644 lib/db/postgres7.php diff --git a/admin/index.php b/admin/index.php index 30447a6702..7f65db4aef 100644 --- a/admin/index.php +++ b/admin/index.php @@ -56,7 +56,8 @@ /// Check version of Moodle code on disk compared with database /// and upgrade if possible. - include_once("$CFG->dirroot/version.php"); # defines $version and upgrades + include_once("$CFG->dirroot/version.php"); # defines $version + include_once("$CFG->dirroot/lib/db/$CFG->dbtype.php"); # defines upgrades if ($CFG->version) { if ($version > $CFG->version) { // upgrade diff --git a/lib/db/mysql.php b/lib/db/mysql.php new file mode 100644 index 0000000000..79987e67c3 --- /dev/null +++ b/lib/db/mysql.php @@ -0,0 +1,81 @@ +config.php and remove all the unused settings (except the database, URL and directory definitions). See config-dist.php for an example of how your new slim config.php should look."); + } + if ($oldversion < 2002092000) { + execute_sql(" ALTER TABLE `user` CHANGE `lang` `lang` VARCHAR(5) DEFAULT 'en' NOT NULL "); + } + if ($oldversion < 2002092100) { + execute_sql(" ALTER TABLE `user` ADD `deleted` TINYINT(1) UNSIGNED DEFAULT '0' NOT NULL AFTER `confirmed` "); + } + + return true; +} + +?> diff --git a/lib/db/postgres7.php b/lib/db/postgres7.php new file mode 100644 index 0000000000..8cb8b6e6e0 --- /dev/null +++ b/lib/db/postgres7.php @@ -0,0 +1,25 @@ + diff --git a/version.php b/version.php index d04d31a44c..de5f4ea266 100644 --- a/version.php +++ b/version.php @@ -1,87 +1,11 @@ config.php and remove all the unused settings (except the database, URL and directory definitions). See config-dist.php for an example of how your new slim config.php should look."); - } - if ($oldversion < 2002092000) { - execute_sql(" ALTER TABLE `user` CHANGE `lang` `lang` VARCHAR(5) DEFAULT 'en' NOT NULL "); - } - if ($oldversion < 2002092100) { - execute_sql(" ALTER TABLE `user` ADD `deleted` TINYINT(1) UNSIGNED DEFAULT '0' NOT NULL AFTER `confirmed` "); - } - - return true; -} - -?> -- 2.39.5