From e6ce125c6864d7277125e0ae6cfb33cb30cc83d8 Mon Sep 17 00:00:00 2001 From: moodler Date: Wed, 27 Apr 2005 06:14:01 +0000 Subject: [PATCH] Fixes for trackingtype upgrade and defaults --- mod/forum/db/mysql.php | 2 +- mod/forum/db/mysql.sql | 1 + mod/forum/db/postgres7.php | 5 +++++ mod/forum/db/postgres7.sql | 3 ++- mod/forum/mod.html | 3 +++ mod/forum/version.php | 2 +- 6 files changed, 13 insertions(+), 3 deletions(-) diff --git a/mod/forum/db/mysql.php b/mod/forum/db/mysql.php index 3f6b16ec8e2..d47b41589be 100644 --- a/mod/forum/db/mysql.php +++ b/mod/forum/db/mysql.php @@ -202,7 +202,7 @@ function forum_upgrade($oldversion) { } if ($oldversion < 2005042500) { - modify_database('','ALTER TABLE prefix_forum ADD `trackingtype` TINYINT(2) UNSIGNED DEFAULT \'2\' NOT NULL AFTER `forcesubscribe`;'); + table_column('forum','','trackingtype','tinyint','2', 'unsigned', '1', '', 'forcesubscribe'); } diff --git a/mod/forum/db/mysql.sql b/mod/forum/db/mysql.sql index 66b1951665a..a54a280c4db 100644 --- a/mod/forum/db/mysql.sql +++ b/mod/forum/db/mysql.sql @@ -16,6 +16,7 @@ CREATE TABLE prefix_forum ( scale int(10) NOT NULL default '0', maxbytes int(10) unsigned NOT NULL default '0', forcesubscribe tinyint(1) unsigned NOT NULL default '0', + trackingtype tinyint(2) unsigned NOT NULL default '1', rsstype tinyint(2) unsigned NOT NULL default '0', rssarticles tinyint(2) unsigned NOT NULL default '0', timemodified int(10) unsigned NOT NULL default '0', diff --git a/mod/forum/db/postgres7.php b/mod/forum/db/postgres7.php index c685d91208c..b489373ae8b 100644 --- a/mod/forum/db/postgres7.php +++ b/mod/forum/db/postgres7.php @@ -141,6 +141,11 @@ function forum_upgrade($oldversion) { );'); } + if ($oldversion < 2005042600) { + table_column('forum','','trackingtype','tinyint','2', 'unsigned', '1', '', 'forcesubscribe'); + modify_database('','CREATE INDEX prefix_forum_track_user_forum_idx ON prefix_forum_track_prefs (userid, forumid);'); + } + return true; diff --git a/mod/forum/db/postgres7.sql b/mod/forum/db/postgres7.sql index 56ae310a8f4..004ca60ef25 100644 --- a/mod/forum/db/postgres7.sql +++ b/mod/forum/db/postgres7.sql @@ -16,6 +16,7 @@ CREATE TABLE prefix_forum ( scale integer NOT NULL default '0', maxbytes integer NOT NULL default '0', forcesubscribe integer NOT NULL default '0', + trackingtype integer NOT NULL default '1', rsstype integer NOT NULL default '0', rssarticles integer NOT NULL default '0', timemodified integer NOT NULL default '0' @@ -155,7 +156,7 @@ CREATE TABLE prefix_forum_track_prefs ( forumid integer NOT NULL default '0' ); -CREATE INDEX user_forum_idx ON prefix_forum_track_prefs (userid, forumid); +CREATE INDEX prefix_forum_track_user_forum_idx ON prefix_forum_track_prefs (userid, forumid); # -------------------------------------------------------- diff --git a/mod/forum/mod.html b/mod/forum/mod.html index 26416e78c56..db8667b56cf 100644 --- a/mod/forum/mod.html +++ b/mod/forum/mod.html @@ -38,6 +38,9 @@ if (!isset($form->assesstimefinish)) { $form->assesstimefinish = 0; } + if (!isset($form->trackingtype)) { + $form->trackingtype = FORUM_TRACKING_OPTIONAL; + } ?>
diff --git a/mod/forum/version.php b/mod/forum/version.php index e59578329e3..279fa087039 100644 --- a/mod/forum/version.php +++ b/mod/forum/version.php @@ -5,7 +5,7 @@ // This fragment is called by /admin/index.php //////////////////////////////////////////////////////////////////////////////// -$module->version = 2005042500; +$module->version = 2005042600; $module->requires = 2005031000; // Requires this Moodle version $module->cron = 60;