Mailinglist
 All Data Structures Files Functions Variables Pages
mailinglist_archive.install
Go to the documentation of this file.
1 <?php
11  $schema=array();
12  $schema['mailinglist_archive'] = array(
13  'description' => 'Table for holding the text of the messages',
14  'fields' => array(
15  'nid' => array(
16  'type' => 'int',
17  'unsigned' => TRUE,
18  'not null' => TRUE,
19  'description' => 'Primary Key for table',
20  ),
21  'list' => array(
22  'type' => 'varchar',
23  'length' => 255,
24  'not null' => TRUE,
25  ),
26  'msg_id' => array(
27  'type' => 'varchar',
28  'length' => '2048',
29  'description' => 'Message ID from message',
30  'not null' => TRUE,
31  ),
32  'reply_to' => array(
33  'type' => 'int',
34  'unsigned' => TRUE,
35  'description' => 'mid of message we are a reply to',
36  ),
37  'thread_id' => array(
38  'type' => 'int',
39  'unsigned' => TRUE,
40  'not null' => TRUE,
41  'description' => 'mid of first message of thread',
42  ),
44  array(
45  'description' => 'Time message was posted',
46  'not null' => TRUE,
47  )
48  ),
49  'year' => array(
50  'type' => 'int',
51  'size' => 'small',
52  'not null' => TRUE,
53  ),
54  'month' => array(
55  'type' => 'int',
56  'size' => 'tiny',
57  'not null' => TRUE,
58  ),
59  'day' => array(
60  'type' => 'int',
61  'size' => 'tiny',
62  'not null' => TRUE,
63  ),
64  'hour' => array(
65  'type' => 'int',
66  'size' => 'tiny',
67  'not null' => TRUE,
68  ),
69  'author' => array(
70  'type' => 'int',
71  'unsigned' => TRUE,
72  'not null' => TRUE,
73  'description' => 'Index to Author\'s ID in mailinglist_names'
74  ),
75  'author_email' => array(
76  'type' => 'varchar',
77  'length' => 255,
78  'not null' => TRUE,
79  ),
80  'status' => array(
81  'type' => 'int',
82  'description' => 'published status, 0 = published, 1 = moderation queue, 2=waiting reply, 3=rejected',
83  'not null' => TRUE,
84  ),
85  // ?? digest flag, topic flags
86  ),
87  'primary key' => array('nid'),
88  'unique key' => array(
89  'msg_id' => array('msg_id'),
90  ),
91  'indexes' => array(
92  'time' => array(array('list', 20), 'time'),
93  'thread_id' => array('thread_id', 'time'),
94  'author_email' => array(array('list', 20), array('author_email',40)),
95  'hour' => array(array('list', 20), 'hour'),
96  'msg_id' => array(array('msg_id', 40)),
97  'reply_to' => array('reply_to', 'time'),
98  'time_parsed' => array(array('list', 20), 'year', 'month', 'day'),
99  ),
100  'foreign keys' => array(
101  'reply_to' => array(
102  'table' => 'mailinglist_archive',
103  'columns' => array('reply_to' => 'nid'),
104  ),
105  'thread_id' => array(
106  'table' => 'mailinglist_archive',
107  'columns' => array('thread_id' => 'nid'),
108  ),
109  'author' => array(
110  'table' => 'mailinglist_names',
111  'columns' => array('author' => 'key'),
112  ),
113  ),
114  );
115 
116  $schema['mailinglist_archive_debug'] = array(
117  'description' => 'Table for holding the text of the messages',
118  'fields' => array(
119  'nid' => array(
120  'type' => 'int',
121  'unsigned' => TRUE,
122  'not null' => TRUE,
123  'description' => 'Primary Key for table',
124  ),
125  'updated' => _mailinglist_datetime_schema(
126  array(
127  'description' => 'Time message was last updated (Debug)',
128  'not null' => TRUE,
129  )
130  ),
131  'headers' => array(
132  'type' => 'text',
133  'serialize' => TRUE,
134  'not null' => TRUE,
135  ),
136  'full_body' => array(
137  'type' => 'text',
138  'serialize' => TRUE,
139  'not null' => TRUE,
140  ),
141  'raw_message' => array(
142  'type' => 'text',
143  'not null' => TRUE,
144  ),
145  ),
146  'primary key' => array('nid'),
147  'indexes' => array(
148  'updated' => array('updated'),
149  ),
150  );
151 
152  $schema['mailinglist_archive_reference'] = array(
153  'description' => 'Table to track the references of a message',
154  'fields' => array(
155  'nid' => array(
156  'type' => 'int',
157  'unsigned' => TRUE,
158  'not null' => TRUE,
159  'description' => 'nid of message these are references to',
160  ),
161  'idx' => array(
162  'type' => 'int',
163  'unsigned' => TRUE,
164  'not null' => TRUE,
165  'description' => 'Sequence number for which ref this is for the meesage'
166  ),
167  'ref_nid' => array(
168  'type' => 'int',
169  'unsigned' => TRUE,
170  'description' => 'mid of message we are a reply to',
171  ),
172  'ref_msg_id' => array(
173  'type' => 'varchar',
174  'length' => '2048',
175  'not null' => TRUE,
176  'description' => 'Message ID of message we are a reply to',
177  ),
178  ),
179  'primary key' => array('nid', 'idx'),
180  'indexes' => array(
181  'ref_nid' => array('ref_nid'),
182  'ref_msg_id' => array(array('ref_msg_id', 40)),
183  ),
184  'foreign keys' => array(
185  'nid' => array(
186  'table' => 'mailinglist_archive',
187  'columns' => array('nid' => 'nid'),
188  ),
189  'ref_nid' => array(
190  'table' => 'mailinglist_archive',
191  'columns' => array('ref_nid' => 'nid'),
192  ),
193  'ref_msgid' => array(
194  'table' => 'mailinglist_archive',
195  'columns' => array('ref_msg_id' => 'msg_id'),
196  ),
197  ),
198  );
199 
200  $schema['mailinglist_archive_thread'] = array(
201  'description' => 'Table for holding information about threads',
202  'fields' => array(
203  'thread_id' => array(
204  'type' => 'int',
205  'unsigned' => TRUE,
206  'not null' => TRUE,
207  'description' => 'mid of first message of thread',
208  ),
209  'list' => array(
210  'type' => 'varchar',
211  'length' => '255',
212  'description' => 'List the thread is on',
213  'not null' => TRUE,
214  ),
215  'start_time' => _mailinglist_datetime_schema(array(
216  'description' => 'Time thread was started',
217  'not null' => TRUE,
218  )),
219  'last_time' => _mailinglist_datetime_schema(array(
220  'description' => 'Time thread was last posted to',
221  'not null' => TRUE,
222  )),
223  ),
224  'primary key' => array('thread_id'),
225  'indexes' => array(
226  'times' => array('list', 'start_time', 'last_time'),
227  ),
228  );
229 
230  $lists = mailinglist_list_load_all();
231  foreach ($lists as $list) {
232  $list_schema = _mailinglist_archives_list_schema($list);
233  $schema += $list_schema;
234  }
235  return $schema;
236 }
237 
247 }
248 
253 }
254 
mailinglist_archive_schema()
Implements hook_schema().
_mailinglist_archives_list_schema($list)
_mailinnglist)archives_list_schema()
mailinglist_archive_modules_enabled($modules)
Implements hook_modules_enabled().
mailinglist_archive_enable()
function mailinglist_archive_update_7000() { }
_mailinglist_datetime_schema($desc)
Return the schema for a 'datetime' field.
mailinglist_list_load_all($show_disabled=TRUE)
Load all mailinglists.