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

Contents of /contributions/modules/listhandler/listhandler.install

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


Revision 1.13 - (show annotations) (download) (as text)
Mon Oct 27 20:05:54 2008 UTC (12 months, 4 weeks ago) by philipnet
Branch: MAIN
CVS Tags: DRUPAL-6--1-0, HEAD
Branch point for: DRUPAL-6--1
Changes since 1.12: +4 -4 lines
File MIME type: text/x-php
Corrected indentation.
1 <?php
2 // $Id: listhandler.install,v 1.12 2008/07/26 16:30:00 philipnet Exp $
3
4 /**
5 * @file
6 * Listhandler install file.
7 */
8
9 /**
10 * Implementation of hook_install().
11 */
12 function listhandler_install() {
13 // Create tables.
14 drupal_install_schema('listhandler');
15 }
16
17 /**
18 * Implementation of hook_uninstall().
19 * Function executed during listhandler module uninstall.
20 */
21 function listhandler_uninstall() {
22 drupal_uninstall_schema('listhandler');
23 variable_del('listhandler_from');
24 variable_del('listhandler_strip_title');
25 variable_del('listhandler_accountstatus');
26 variable_del('listhandler_attachments_as_link');
27 variable_del('listhandler_htmltotext');
28 }
29
30 /**
31 * Listhandler module database schema.
32 * Implementation of hook_schema().
33 */
34 function listhandler_schema() {
35 $schema['listhandler'] = array(
36 'description' => t(''),
37 'fields' => array(
38 'lid' => array(
39 'description' => t(''),
40 'type' => 'serial',
41 'unsigned' => TRUE,
42 'not null' => TRUE
43 ),
44 'msgid' => array(
45 'description' => t(''),
46 'type' => 'varchar',
47 'length' => 255,
48 'not null' => TRUE
49 ),
50 'nid' => array(
51 'description' => t(''),
52 'type' => 'int',
53 'size' => 'normal',
54 'not null' => TRUE,
55 'default' => 0
56 ),
57 'cid' => array(
58 'description' => t(''),
59 'type' => 'int',
60 'size' => 'normal',
61 'not null' => TRUE,
62 'default' => 0
63 ),
64 'pid' => array(
65 'description' => t(''),
66 'type' => 'int',
67 'size' => 'normal',
68 'not null' => TRUE,
69 'default' => 0
70 ),
71 'uid' => array(
72 'description' => t(''),
73 'type' => 'int',
74 'size' => 'normal',
75 'not null' => TRUE,
76 'default' => 0
77 ),
78 'mid' => array(
79 'description' => t(''),
80 'type' => 'int',
81 'size' => 'normal',
82 'not null' => TRUE,
83 'default' => 0
84 ),
85 'tid' => array(
86 'description' => t(''),
87 'type' => 'int',
88 'size' => 'normal',
89 'not null' => TRUE,
90 'default' => 0
91 )
92 ),
93 'primary key' => array('lid')
94 );
95
96 $schema['listhandler_prefix'] = array(
97 'description' => t(''),
98 'fields' => array(
99 'mid' => array(
100 'description' => t(''),
101 'type' => 'serial',
102 'unsigned' => TRUE,
103 'not null' => TRUE
104 ),
105 'prefix' => array(
106 'description' => t(''),
107 'type' => 'varchar',
108 'length' => 255,
109 'default' => ''
110 )
111 ),
112 'primary key' => array('mid')
113 );
114
115 return $schema;
116 }
117
118 /**
119 * Update database hooks.
120 */
121 function listhandler_update_1() {
122 return _system_update_utf8(array('listhandler'));
123 }
124
125 function listhandler_update_5000() {
126 $items = array();
127
128 db_drop_index($items, "listhandler", "lid");
129
130 return $items;
131 }
132
133 function listhandler_update_6000() {
134 // Migrate the extra column in {mailhandler} into a listhandler table:
135 $ret = array();
136 if (db_column_exists('{mailhandler}', 'prefix')) {
137 watchdog('listhandler', 'We are updating the listhandler_prefix table', array(), WATCHDOG_DEBUG);
138 $schema['listhandler_prefix'] = array(
139 'description' => '',
140 'fields' => array(
141 'mid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE),
142 'prefix' => array('type' => 'varchar', 'length' => 255, 'default' => '')
143 ),
144 'primary key' => array('mid')
145 );
146 db_create_table($ret, 'listhandler_prefix', $schema['listhandler_prefix']);
147 $result = db_query("SELECT mid,prefix FROM {mailhandler} WHERE prefix <> ''");
148 while ($row = db_fetch_array($result)) {
149 watchdog('listhandler', "INSERT INTO listhandler_prefix VALUES('%mid', '%prefix')", array('%mid' => $row['mid'], '%prefix' => $row['prefix']), WATCHDOG_DEBUG);
150 $res = db_query("INSERT INTO {listhandler_prefix} VALUES('%s', '%s')", $row['mid'], $row['prefix']);
151 }
152 db_drop_field($ret, '{mailhandler}', 'prefix');
153 }
154 return $ret;
155 }

  ViewVC Help
Powered by ViewVC 1.1.2