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

Contents of /contributions/modules/netforum/netforum.install

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


Revision 1.5 - (show annotations) (download) (as text)
Sun Aug 31 23:43:54 2008 UTC (14 months, 3 weeks ago) by jamesmichaelhill
Branch: MAIN
CVS Tags: DRUPAL-5--0-9, DRUPAL-5--1-1, DRUPAL-5--1-0, HEAD
Branch point for: DRUPAL-6--2
Changes since 1.4: +8 -1 lines
File MIME type: text/x-php
Added support for netforum OD
1 <?php
2 // $Id: netforum.install,v 1.4 2008/01/14 04:06:32 jamesmichaelhill Exp $
3
4
5 /**
6 * Implementations of hook_update (called by update.php)
7 */
8
9 function netforum_update_3() {
10 //Determine if the existing installation is using netFORUM On Demand
11 if (stristr(variable_get('netforum_wsdl_url', ""), 'netForumXMLOnDemand.asmx')) {
12 variable_set('netforum_xweb_od', 1);
13 }
14 }
15
16 function netforum_update_2() {
17 //adding obj_key_field
18 switch ($GLOBALS['db_type']) {
19 case 'pgsql':
20 return array();
21 break;
22
23 case 'mysql':
24 case 'mysqli':
25 $ret[] = update_sql("ALTER TABLE {netforum_object_cache} ADD obj_key_field varchar(60)");
26 break;
27
28 }
29
30 return $ret;
31 }
32
33 // Update#1: add columns to the netforum_object_cache table
34 function netforum_update_1() {
35 //adding obj_prefix, obj_defaultcolumns, obj_defaultorderby
36 switch ($GLOBALS['db_type']) {
37 case 'pgsql':
38 return array();
39 break;
40
41 case 'mysql':
42 case 'mysqli':
43 $ret[] = update_sql("ALTER TABLE {netforum_object_cache} ADD (obj_prefix varchar(3) NOT NULL, obj_defaultcolumns varchar(255), obj_defaultorderby varchar(255) )");
44 $ret[] = update_sql("ALTER TABLE {netforum_object_cache} CHANGE name obj_name varchar(255) NOT NULL");
45 $ret[] = update_sql("ALTER TABLE {netforum_object_cache} add key(obj_key)");
46 $ret[] = update_sql("ALTER TABLE {netforum_request_cache} ADD arguments_sha1_hash varchar(40) after arguments");
47 $ret[] = update_sql("UPDATE {netforum_request_cache} set arguments_sha1_hash = sha1(arguments)");
48 $ret[] = update_sql("ALTER TABLE {netforum_request_cache} add key(arguments_sha1_hash)");
49 drupal_set_message(t("Remember to !update your netFORUM object cache if the changes were successful", array('!update' => l('update', 'admin/settings/netforum/objectnamesrefresh'))));
50 break;
51 }
52
53 return $ret;
54 }
55
56
57
58 /**
59 * Implementation of hook_install
60 * Adding table netforum_request_cache
61 */
62 function netforum_install () {
63 switch ($GLOBALS['db_type']) {
64 case 'pgsql':
65 $success = FALSE;
66 break;
67
68 case 'mysql':
69 case 'mysqli':
70
71 db_query("CREATE TABLE {netforum_request_cache} (
72 user_name varchar(255),
73 wsdl_loc varchar(255),
74 request varchar(255),
75 arguments text,
76 arguments_sha1_hash varchar(40),
77 response longtext,
78 add_date datetime not null,
79 PRIMARY KEY (add_date),
80 key (request),
81 key(arguments_sha1_hash)
82 ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;");
83
84 db_query("CREATE TABLE {netforum_object_cache} (
85 obj_name varchar(255) NOT NULL,
86 obj_key varchar(36) NOT NULL,
87 obj_key_field varchar(60),
88 obj_prefix varchar(3) NOT NULL,
89 obj_defaultcolumns varchar(255),
90 obj_defaultorderby varchar(255),
91 data longtext,
92 PRIMARY KEY (obj_name),
93 key (obj_key)
94 ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;");
95
96 $success = TRUE;
97 break;
98 } // End case
99
100 // Notify of changes
101 if ($success) {
102 drupal_set_message(t('Netforum module installed tables successfully. Remember to visit the '. l(t('netforum settings'), 'admin/settings/netforum') .' before use.'));
103 }
104 else {
105 drupal_set_message(t('The installation of Netforum module was unsuccessful.'), 'error');
106 }
107 }
108
109 function netforum_uninstall() {
110 db_query('DROP TABLE {netforum_request_cache}');
111 db_query('DROP TABLE {netforum_object_cache}');
112 variable_del('netforum_cache_max');
113 variable_del('netforum_cache_default');
114 variable_del('netforum_wsdl_url');
115 variable_del('netforum_xweb_username');
116 variable_del('netforum_xweb_password');
117 variable_del('netforum_verify_availability');
118 variable_del('netforum_verify_length');
119 variable_del('netforum_verify_timeout');
120 variable_del('netforum_slow_query_limit');
121 drupal_set_message(t('Netforum module has been successfully uninstalled.'));
122 }

  ViewVC Help
Powered by ViewVC 1.1.2