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

Contents of /contributions/modules/buddylist/buddylist.install

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


Revision 1.10 - (show annotations) (download) (as text)
Wed Dec 6 21:22:04 2006 UTC (2 years, 11 months ago) by robertDouglass
Branch: MAIN
CVS Tags: HEAD
Changes since 1.9: +39 -2 lines
File MIME type: text/x-php
#80166 by ankur: optional workflow to send request emails to the user who must approve or deny the request to become buddies.
1 <?php
2 // $Id: buddylist.install,v 1.9 2006/11/29 23:15:38 robertDouglass Exp $
3
4 /**
5 * Install the initial schema.
6 */
7 function buddylist_install() {
8 switch ($GLOBALS['db_type']) {
9 case 'mysql':
10 case 'mysqli':
11 $query1 = db_query("
12 CREATE TABLE {buddylist} (
13 uid int(10) unsigned NOT NULL default '0',
14 buddy int(10) unsigned NOT NULL default '0',
15 timestamp int(11) NOT NULL default '0',
16 received tinyint(1) NOT NULL default '0',
17 PRIMARY KEY (uid,buddy)
18 ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
19
20 $query2 = db_query("
21 CREATE TABLE {buddylist_buddy_group} (
22 uid int(11) NOT NULL default '0',
23 buddy int(11) NOT NULL default '0',
24 label_id int(11) NOT NULL default '0',
25 PRIMARY KEY (uid, buddy, label_id)
26 ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
27
28 $query3 = db_query("
29 CREATE TABLE {buddylist_groups} (
30 uid int(11) NOT NULL default '0',
31 label_id int(11) NOT NULL default '0',
32 label varchar(255) NOT NULL default '',
33 visible tinyint(1) NOT NULL default '0',
34 PRIMARY KEY (uid, label_id)
35 ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
36
37 $query4 = db_query("
38 CREATE TABLE {buddylist_pending_requests} (
39 requester_uid int(11) NOT NULL default '0',
40 requestee_uid int(11) NOT NULL default '0',
41 received tinyint(1),
42 PRIMARY KEY (requester_uid, requestee_uid)
43 ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
44
45 if ($query1 && $query2 && $query3 && $query4) {
46 $created = TRUE;
47 }
48 break;
49 }
50 if ($created) {
51 drupal_set_message(t('Buddylist module installed successfully.'));
52 }
53 else {
54 drupal_set_message(t('Table installation for the Buddylist module was unsuccessful. The tables may need to be installed by hand. See the README.txt file for a list of the installation queries.'), 'error');
55 }
56 }
57
58 function buddylist_update_1() {
59 return _system_update_utf8(array('buddylist'));
60 }
61
62 function buddylist_update_2() {
63 $ret = array();
64
65 switch ($GLOBALS['db_type']) {
66 case 'mysql':
67 case 'mysqli':
68 $result = update_sql("
69 CREATE TABLE {buddylist_pending_requests} (
70 requester_uid int(11) NOT NULL default '0',
71 requestee_uid int(11) NOT NULL default '0',
72 received tinyint(1),
73 PRIMARY KEY (requester_uid, requestee_uid)
74 ) /*!40100 DEFAULT CHARACTER SET utf8 */;
75 ");
76
77 $ret[] = $result;
78 break;
79 }
80
81 if ($result['success']) {
82 drupal_set_message(t('The database schema update for the Buddylist module was successful.'));
83 }
84 else {
85 drupal_set_message(t('Table database schema update for the Buddylist module was unsuccessful. The schema may need to be updated by hand. See the README.txt file for a list of the installation queries.'), 'error');
86 }
87
88 return $ret;
89 }

  ViewVC Help
Powered by ViewVC 1.1.2