/[drupal]/contributions/modules/discussthis/discussthis.install
ViewVC logotype

Contents of /contributions/modules/discussthis/discussthis.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Thu Jun 19 22:00:41 2008 UTC (17 months, 1 week ago) by spiderman
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-5, DRUPAL-6--1
File MIME type: text/x-php
Initial commit of disussthis module. Allows auto-linking between nodes and forum topics discussing them.
1 <?php
2 // $Id$
3
4 /**
5 * Implementation of hook_install. Sets up two tables for the module's use.
6 * discussthis stores nid->topic mapping, and discussthis_forums stores
7 * nid->forum(tid) mapping.
8 **/
9 function discussthis_install() {
10 switch ($GLOBALS['db_type']) {
11 case 'mysql':
12 case 'mysqli':
13 db_query("CREATE TABLE {discussthis} (
14 nid int unsigned NOT NULL default '0',
15 topic_nid int unsigned NOT NULL default '0',
16 PRIMARY KEY (nid)
17 ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
18
19 db_query("CREATE TABLE {discussthis_forums} (
20 nid int unsigned NOT NULL default '0',
21 forum_tid int unsigned NOT NULL default '0',
22 PRIMARY KEY (nid)
23 ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
24
25 drupal_set_message(t("Discuss This! module installed. Configure !perm and !settings to continue", array('!perm' => l('Administer > User > Access Control','admin/user/access'), '!settings' => l('Administer > Site Configuration > Discuss This', 'admin/settings/discussthis'))));
26 break;
27 case 'pgsql': // someone else?
28 break;
29 }
30 }
31
32 function discussthis_update_1() {
33 $ret = array();
34 switch ($GLOBALS['db_type']) {
35 case 'mysql':
36 case 'mysqli':
37 $ret[] = update_sql("CREATE TABLE {discussthis_forums} (
38 nid int unsigned NOT NULL default '0',
39 forum_tid int unsigned NOT NULL default '0',
40 PRIMARY KEY (nid)
41 ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
42 }
43 return $ret;
44 }
45
46 /**
47 * Implementation of hook_uninstall. Drops the two db tables used by this module.
48 **/
49 function discussthis_uninstall() {
50 db_query('DROP TABLE {discussthis');
51 db_query('DROP TABLE {discussthis_forums');
52 // variable_del('discussthis_nodetypes')
53 }
54

  ViewVC Help
Powered by ViewVC 1.1.2