OK, some massive changes with many files removed or changed.
[moodle.git] / mod / forum / version.php
CommitLineData
501cdbd8 1<?PHP // $Id$
2
3////////////////////////////////////////////////////////////////////////////////
4// Code fragment to define the module version etc.
5// This fragment is called by /admin/index.php
6////////////////////////////////////////////////////////////////////////////////
7
8$module->fullname = "Forum";
9$module->version = 2002073008;
10$module->cron = 60;
11$module->search = "";
12
13function forum_upgrade($oldversion) {
14// This function does anything necessary to upgrade
15// older versions to match current functionality
16
17 if ($oldversion < 2002073008) {
18 execute_sql("DELETE FROM modules WHERE name = 'discuss' ");
19 execute_sql("ALTER TABLE `discuss` RENAME `forum_discussions` ");
20 execute_sql("ALTER TABLE `discuss_posts` RENAME `forum_posts` ");
21 execute_sql("ALTER TABLE `discuss_ratings` RENAME `forum_ratings` ");
22 execute_sql("ALTER TABLE `forum` CHANGE `intro` `intro` TEXT NOT NULL ");
23 execute_sql("ALTER TABLE `forum` ADD `forcesubscribe` TINYINT(1) UNSIGNED DEFAULT '0' NOT NULL AFTER `assessed`");
24 execute_sql("ALTER TABLE `forum` CHANGE `type` `type` ENUM( 'single', 'news', 'social', 'general',
25 'eachuser', 'teacher' ) DEFAULT 'general' NOT NULL ");
26 execute_sql("ALTER TABLE `forum_posts` CHANGE `discuss` `discussion` INT( 10 ) UNSIGNED DEFAULT '0' NOT NULL ");
27 execute_sql("INSERT INTO log_display VALUES ('forum', 'add', 'forum', 'name') ");
28 execute_sql("INSERT INTO log_display VALUES ('forum', 'add discussion', 'forum_discussions', 'name') ");
29 execute_sql("INSERT INTO log_display VALUES ('forum', 'add post', 'forum_posts', 'subject') ");
30 execute_sql("INSERT INTO log_display VALUES ('forum', 'update post', 'forum_posts', 'subject') ");
31 execute_sql("INSERT INTO log_display VALUES ('forum', 'view discussion', 'forum_discussions', 'name') ");
32 execute_sql("DELETE FROM log_display WHERE module = 'discuss' ");
33 execute_sql("UPDATE log SET action = 'view discussion' WHERE module = 'discuss' AND action = 'view' ");
34 execute_sql("UPDATE log SET action = 'add discussion' WHERE module = 'discuss' AND action = 'add' ");
35 execute_sql("UPDATE log SET module = 'forum' WHERE module = 'discuss' ");
36 notify("Renamed all the old discuss tables (now part of forum) and created new forum_types");
37 }
38
39 return true;
40
41}
42
43
44
45?>
46