From a13e99bd67cb440db430adbdd0545427153eea2b Mon Sep 17 00:00:00 2001 From: martinlanghoff Date: Mon, 30 May 2005 05:22:07 +0000 Subject: [PATCH] Merged from MOODLE_15_STABLE - Created config_plugins table to manage configuration entries on a per-module/plugin. This breaks the rules a little bit, but it has been discussed with MD. --- lib/db/mysql.php | 15 ++++++++++++++- lib/db/mysql.sql | 15 +++++++++++++++ lib/db/postgres7.php | 14 ++++++++++++++ lib/db/postgres7.sql | 8 ++++++++ version.php | 2 +- 5 files changed, 52 insertions(+), 2 deletions(-) diff --git a/lib/db/mysql.php b/lib/db/mysql.php index e267a836ee8..68d4cda95e8 100644 --- a/lib/db/mysql.php +++ b/lib/db/mysql.php @@ -1370,7 +1370,20 @@ function main_upgrade($oldversion=0) { table_column('user', '', 'trackforums', 'int', '4', 'unsigned', '0', 'not null', 'autosubscribe'); } - + if ($oldversion < 2005053000 ) { // Add config_plugins table + + // this table was created on the MOODLE_15_STABLE branch + // so it may already exist. + $result = execute_sql("CREATE TABLE IF NOT EXISTS `{$CFG->prefix}config_plugins` ( + `id` int(10) unsigned NOT NULL auto_increment, + `plugin` varchar(250) NOT NULL default 'core', + `name` varchar(250) NOT NULL default '', + `value` text NOT NULL default '', + PRIMARY KEY (`id`), + UNIQUE KEY `plugin_name` (`plugin`, `name`) + ) TYPE=MyISAM + COMMENT='Moodle modules and plugins configuration variables';"); + } return $result; } diff --git a/lib/db/mysql.sql b/lib/db/mysql.sql index 3a64fd5c352..a9a565bc599 100644 --- a/lib/db/mysql.sql +++ b/lib/db/mysql.sql @@ -23,6 +23,21 @@ CREATE TABLE `prefix_config` ( ) TYPE=MyISAM COMMENT='Moodle configuration variables'; # -------------------------------------------------------- +# +# Table structure for table `config_plugins` +# + +CREATE TABLE `prefix_config_plugins` ( + `id` int(10) unsigned NOT NULL auto_increment, + `plugin` varchar(255) NOT NULL default 'core', + `name` varchar(255) NOT NULL default '', + `value` text NOT NULL default '', + PRIMARY KEY (`id`), + UNIQUE KEY `plugin_name` (`plugin`, `name`) +) TYPE=MyISAM COMMENT='Moodle modules and plugins configuration variables'; +# -------------------------------------------------------- + + # # Table structure for table `course` # diff --git a/lib/db/postgres7.php b/lib/db/postgres7.php index 638f74ea4c3..b8b8a108672 100644 --- a/lib/db/postgres7.php +++ b/lib/db/postgres7.php @@ -1090,6 +1090,20 @@ function main_upgrade($oldversion=0) { table_column('grade_category', 'weight', 'weight', 'numeric(5,2)', '', '', '0.00', '', ''); } + if ($oldversion < 2005053000 ) { // Add config_plugins table + + // this table was created on the MOODLE_15_STABLE branch + // so it may already exist. Therefore we hide potential errors + // (Postgres doesn't support CREATE TABLE IF NOT EXISTS) + execute_sql("CREATE TABLE {$CFG->prefix}config_plugins ( + id SERIAL PRIMARY KEY, + plugin varchar(255) NOT NULL default 'core', + name varchar(255) NOT NULL default '', + value text NOT NULL default '', + CONSTRAINT {$CFG->prefix}config_plugins_plugin_name_uk UNIQUE (plugin, name) + );", false); + + } return $result; } diff --git a/lib/db/postgres7.sql b/lib/db/postgres7.sql index 28bf1fb90c0..3fbe7c7ca78 100644 --- a/lib/db/postgres7.sql +++ b/lib/db/postgres7.sql @@ -5,6 +5,14 @@ CREATE TABLE prefix_config ( CONSTRAINT prefix_config_name_uk UNIQUE (name) ); +CREATE TABLE prefix_config_plugins ( + id SERIAL PRIMARY KEY, + plugin varchar(255) NOT NULL default 'core', + name varchar(255) NOT NULL default '', + value text NOT NULL default '', + CONSTRAINT prefix_config_plugins_plugin_name_uk UNIQUE (plugin, name) +); + CREATE TABLE prefix_course ( id SERIAL PRIMARY KEY, category integer NOT NULL default '0', diff --git a/version.php b/version.php index 1fbcd0114ba..be4372e5b1b 100644 --- a/version.php +++ b/version.php @@ -6,7 +6,7 @@ // This is compared against the values stored in the database to determine // whether upgrades should be performed (see lib/db/*.php) - $version = 2005052400; // YYYYMMDD = date + $version = 2005053000; // YYYYMMDD = date // XY = increments within a single day $release = '1.6 development'; // Human-friendly version name