← Index
NYTProf Performance Profile   « line view »
For /usr/local/libexec/sympa/task_manager-debug.pl
  Run on Tue Jun 1 22:32:51 2021
Reported on Tue Jun 1 22:35:09 2021

Filename/usr/local/libexec/sympa/Sympa/DatabaseDescription.pm
StatementsExecuted 0 statements in 0s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
0000s0sSympa::DatabaseDescription::::BEGIN@30Sympa::DatabaseDescription::BEGIN@30
0000s0sSympa::DatabaseDescription::::BEGIN@31Sympa::DatabaseDescription::BEGIN@31
0000s0sSympa::DatabaseDescription::::BEGIN@33Sympa::DatabaseDescription::BEGIN@33
0000s0sSympa::DatabaseDescription::::__ANON__Sympa::DatabaseDescription::__ANON__ (xsub)
0000s0sSympa::DatabaseDescription::::autoincrementSympa::DatabaseDescription::autoincrement
0000s0sSympa::DatabaseDescription::::full_db_structSympa::DatabaseDescription::full_db_struct
0000s0sSympa::DatabaseDescription::::not_nullSympa::DatabaseDescription::not_null
0000s0sSympa::DatabaseDescription::::primarySympa::DatabaseDescription::primary
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1# -*- indent-tabs-mode: nil; -*-
2# vim:ft=perl:et:sw=4
3# $Id$
4
5# Sympa - SYsteme de Multi-Postage Automatique
6#
7# Copyright (c) 1997, 1998, 1999 Institut Pasteur & Christophe Wolfhugel
8# Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
9# 2006, 2007, 2008, 2009, 2010, 2011 Comite Reseau des Universites
10# Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016, 2017 GIP RENATER
11# Copyright 2017, 2018, 2019 The Sympa Community. See the AUTHORS.md file at
12# the top-level directory of this distribution and at
13# <https://github.com/sympa-community/sympa.git>.
14#
15# This program is free software; you can redistribute it and/or modify
16# it under the terms of the GNU General Public License as published by
17# the Free Software Foundation; either version 2 of the License, or
18# (at your option) any later version.
19#
20# This program is distributed in the hope that it will be useful,
21# but WITHOUT ANY WARRANTY; without even the implied warranty of
22# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23# GNU General Public License for more details.
24#
25# You should have received a copy of the GNU General Public License
26# along with this program. If not, see <http://www.gnu.org/licenses/>.
27
28package Sympa::DatabaseDescription;
29
30use strict;
31use warnings;
32
33use Sympa::Constants;
34
35my $email_struct = sprintf 'varchar(%d)', Sympa::Constants::EMAIL_LEN();
36my $family_struct = sprintf 'varchar(%d)', Sympa::Constants::FAMILY_LEN();
37my $list_struct = sprintf 'varchar(%d)', Sympa::Constants::LIST_LEN();
38my $robot_struct = sprintf 'varchar(%d)', Sympa::Constants::ROBOT_LEN();
39my $list_id_struct = sprintf 'varchar(%d)',
40 Sympa::Constants::LIST_LEN() + 1 + Sympa::Constants::ROBOT_LEN();
41
42my %full_db_struct = (
43 'subscriber_table' => {
44 'fields' => {
45 'user_subscriber' => {
46 'struct' => $email_struct,
47 'doc' => 'email of subscriber',
48 'primary' => 1,
49 'not_null' => 1,
50 'order' => 1
51 },
52 'list_subscriber' => {
53 'struct' => $list_struct,
54 'doc' => 'list name of a subscription',
55 'primary' => 1,
56 'not_null' => 1,
57 'order' => 2
58 },
59 'robot_subscriber' => {
60 'struct' => $robot_struct,
61 'doc' => 'robot (domain) of the list',
62 'primary' => 1,
63 'not_null' => 1,
64 'order' => 3
65 },
66 'reception_subscriber' => {
67 'struct' => 'varchar(20)',
68 'doc' =>
69 'reception format option of subscriber (digest, summary, etc.)',
70 'order' => 4,
71 },
72 'suspend_subscriber' => {
73 'struct' => 'int(1)',
74 'doc' => 'boolean set to 1 if subscription is suspended',
75 'order' => 5,
76 },
77 'suspend_start_date_subscriber' => {
78 'struct' => 'int(11)',
79 'doc' => 'the Unix time when message reception is suspended',
80 'order' => 6,
81 },
82 'suspend_end_date_subscriber' => {
83 'struct' => 'int(11)',
84 'doc' =>
85 'the Unix time when message reception should be restored',
86 'order' => 7,
87 },
88 'bounce_subscriber' => {
89 'struct' => 'varchar(35)',
90 'doc' => 'FIXME',
91 'order' => 8,
92 },
93 'bounce_score_subscriber' => {
94 'struct' => 'smallint(6)',
95 'doc' => 'FIXME',
96 'order' => 9,
97 },
98 'bounce_address_subscriber' => {
99 'struct' => $email_struct,
100 'doc' => 'FIXME',
101 'order' => 10,
102 },
103 #'date_subscriber' => {
104 # 'struct' => 'datetime',
105 # 'doc' => 'date of subscription',
106 # 'not_null' => 1,
107 # 'order' => 11,
108 #},
109 'date_epoch_subscriber' => {
110 'struct' => 'int(11)',
111 'doc' => 'date of subscription',
112 'not_null' => 1,
113 'order' => 11.5,
114 },
115 # Obsoleted as of 6.2.25b.2. Use update_epoch_subscriber.
116 #'update_subscriber' => {
117 # 'struct' => 'datetime',
118 # 'doc' =>
119 # 'the latest date where subscription is confirmed by subscriber',
120 # 'order' => 12,
121 #},
122 'update_epoch_subscriber' => {
123 'struct' => 'int(11)',
124 'doc' =>
125 'the last time when subscription is confirmed by subscriber',
126 'order' => 12.5,
127 },
128 'inclusion_subscriber' => {
129 'struct' => 'int(11)',
130 'doc' =>
131 'the last time when list user is synchronized with data source',
132 'order' => 12.6,
133 },
134 'inclusion_ext_subscriber' => {
135 'struct' => 'int(11)',
136 'doc' =>
137 'the last time when list user is synchronized with external data source',
138 'order' => 12.7,
139 },
140 'inclusion_label_subscriber' => {
141 'struct' => 'varchar(50)',
142 'doc' => 'name of data source',
143 'order' => 12.8,
144 },
145 'comment_subscriber' => {
146 'struct' => 'varchar(150)',
147 'doc' => 'free form name',
148 'order' => 13,
149 },
150 'number_messages_subscriber' => {
151 'struct' => 'int(5)',
152 'doc' => 'the number of message the subscriber sent',
153 'not_null' => 1,
154 'order' => 5,
155 'order' => 14,
156 },
157 'visibility_subscriber' => {
158 'struct' => 'varchar(20)',
159 'doc' => 'FIXME',
160 'order' => 15,
161 },
162 'topics_subscriber' => {
163 'struct' => 'varchar(200)',
164 'doc' => 'topic subscription specification',
165 'order' => 16,
166 },
167 'subscribed_subscriber' => {
168 'struct' => 'int(1)',
169 'doc' =>
170 'boolean set to 1 if subscriber comes from ADD or SUB',
171 'order' => 17,
172 },
173 # Obsoleted as of 6.2.45b. Use inclusion_subscriber.
174 #'included_subscriber' => {
175 # 'struct' => 'int(1)',
176 # 'doc' =>
177 # 'boolean, set to 1 is subscriber comes from an external datasource. Note that included_subscriber and subscribed_subscriber can both value 1',
178 # 'order' => 18,
179 #},
180 # Ditto.
181 #'include_sources_subscriber' => {
182 # 'struct' => 'varchar(50)',
183 # 'doc' =>
184 # 'comma separated list of datasource that contain this subscriber',
185 # 'order' => 19,
186 #},
187 'custom_attribute_subscriber' => {
188 'struct' => 'text',
189 'doc' => 'FIXME',
190 'order' => 20,
191 },
192
193 },
194 'doc' => 'This table store subscription, subscription option etc.',
195 'order' => 1,
196 },
197 'user_table' => {
198 'fields' => {
199 'email_user' => {
200 'struct' => $email_struct,
201 'doc' => 'email of user',
202 'primary' => 1,
203 'not_null' => 1,
204 'order' => 1,
205 },
206 'gecos_user' => {
207 'struct' => 'varchar(150)',
208 'doc' => 'display name of user',
209 'order' => 3,
210 },
211 'password_user' => {
212 'struct' => 'varchar(64)',
213 'doc' => 'password are stored as finger print',
214 'order' => 2,
215 },
216 'last_login_date_user' => {
217 'struct' => 'int(11)',
218 'doc' =>
219 'Unix time of last login, printed in login result for security purpose',
220 'order' => 4,
221 },
222 'last_login_host_user' => {
223 'struct' => 'varchar(60)',
224 'doc' =>
225 'host of last login, printed in login result for security purpose',
226 'order' => 5,
227 },
228 'wrong_login_count_user' => {
229 'struct' => 'int(11)',
230 'doc' =>
231 'login attempt count, used to prevent brute force attack',
232 'order' => 6,
233 },
234 'last_active_date_user' => {
235 'struct' => 'int(11)',
236 'doc' =>
237 'the last Unix time when this user was confirmed their activity by purge_user_table task',
238 'order' => 7,
239 },
240 'cookie_delay_user' => {
241 'struct' => 'int(11)',
242 'doc' => 'FIXME',
243 'order' => 8,
244 },
245 'lang_user' => {
246 'struct' => 'varchar(10)',
247 'doc' => 'user language preference',
248 'order' => 9,
249 },
250 'attributes_user' => {
251 'struct' => 'text',
252 'doc' => 'FIXME',
253 'order' => 10,
254 },
255 'data_user' => {
256 'struct' => 'text',
257 'doc' => 'FIXME',
258 'order' => 11,
259 },
260 },
261 'doc' =>
262 'The user_table is mainly used to manage login from web interface. A subscriber may not appear in the user_table if they never log through the web interface.',
263 'order' => 2,
264 },
265 #'bulkspool_table' => {
266 # 'fields' => {
267 # 'messagekey_bulkspool' => {
268 # 'struct' => 'varchar(33)',
269 # 'doc' => 'primary key',
270 # 'primary' => 1,
271 # 'not_null' => 1,
272 # 'order' => 1,
273 # },
274 # 'message_bulkspool' => {
275 # 'struct' => 'longtext',
276 # 'doc' => 'message as string b64 encoded',
277 # 'order' => 2,
278 # },
279 # #'messageid_bulkspool' => {
280 # # 'struct' => 'varchar(300)',
281 # # 'doc' => 'stored to list spool content faster',
282 # # 'order' => 4,
283 # #},
284 # 'lock_bulkspool' => {
285 # 'struct' => 'int(1)',
286 # 'doc' =>
287 # 'when set to 1, this field prevents Sympa from processing the message',
288 # 'order' => 5,
289 # },
290 # #'dkim_privatekey_bulkspool' => {
291 # # 'struct' => 'varchar(2000)',
292 # # 'doc' =>
293 # # 'DKIM parameter stored for bulk daemon because bulk ignore list parameters, private key to sign message',
294 # # 'order' => 6,
295 # #},
296 # #'dkim_selector_bulkspool' => {
297 # # 'struct' => 'varchar(50)',
298 # # 'doc' =>
299 # # 'DKIM parameter stored for bulk daemon because bulk ignore list parameters, DKIM selector to sign message',
300 # # 'order' => 7,
301 # #},
302 # #'dkim_d_bulkspool' => {
303 # # 'struct' => 'varchar(50)',
304 # # 'doc' =>
305 # # 'DKIM parameter stored for bulk daemon because bulk ignore list parameters, the d DKIM parameter',
306 # # 'order' => 8,
307 # #},
308 # #'dkim_i_bulkspool' => {
309 # # 'struct' => $email_struct,
310 # # 'doc' =>
311 # # 'DKIM parameter stored for bulk daemon because bulk ignore list parameters, DKIM i signature parameter',
312 # # 'order' => 9,
313 # #},
314 # },
315 # 'doc' => 'This table contains the messages to be sent by bulk.pl',
316 # 'order' => 3,
317 #},
318 #'bulkmailer_table' => {
319 # 'fields' => {
320 # 'messagekey_bulkmailer' => {
321 # 'struct' => 'varchar(80)',
322 # 'doc' =>
323 # 'A pointer to a message in spool_table.It must be a value of a line in table spool_table with same value as messagekey_bulkspool',
324 # 'primary' => 1,
325 # 'not_null' => 1,
326 # 'order' => 1,
327 # },
328 # 'packetid_bulkmailer' => {
329 # 'struct' => 'varchar(33)',
330 # 'doc' => 'An id for the packet',
331 # 'primary' => 1,
332 # 'not_null' => 1,
333 # 'order' => 2,
334 # },
335 # #'messageid_bulkmailer' => {
336 # # 'struct' => 'varchar(200)',
337 # # 'doc' => 'The message Id',
338 # # 'order' => 3,
339 # #},
340 # ##FIXME: column name is "recEipients_bulkmailer"
341 # 'receipients_bulkmailer' => {
342 # 'struct' => 'text',
343 # 'doc' =>
344 # 'the comma separated list of recipient email for this message',
345 # 'order' => 4,
346 # },
347 # #'returnpath_bulkmailer' => {
348 # # 'struct' => $email_struct,
349 # # 'doc' =>
350 # # 'the return path value that must be set when sending the message',
351 # # 'order' => 5,
352 # #},
353 # 'robot_bulkmailer' => {
354 # 'struct' => $robot_struct,
355 # 'doc' => '',
356 # 'order' => 6,
357 # },
358 # 'listname_bulkmailer' => {
359 # 'struct' => $list_struct,
360 # 'doc' => '',
361 # 'order' => 7,
362 # },
363 # #'verp_bulkmailer' => {
364 # # 'struct' => 'int(1)',
365 # # 'doc' =>
366 # # 'A boolean to specify if VERP is requiered, in this case return_path will be formatted using VERP form',
367 # # 'order' => 8,
368 # #},
369 # #'tracking_bulkmailer' => {
370 # # 'struct' => "enum('mdn','dsn')",
371 # # 'doc' => 'Is DSN or MDN requiered when sending this message?',
372 # # 'order' => 9,
373 # #},
374 # #'merge_bulkmailer' => {
375 # # 'struct' => 'int(1)',
376 # # 'doc' =>
377 # # 'Boolean, if true, the message is to be parsed as a TT2 template foreach recipient',
378 # # 'order' => 10,
379 # #},
380 # 'priority_message_bulkmailer' => {
381 # 'struct' => 'smallint(10)',
382 # 'doc' => 'FIXME',
383 # 'order' => 11,
384 # },
385 # 'priority_packet_bulkmailer' => {
386 # 'struct' => 'smallint(10)',
387 # 'doc' => 'FIXME',
388 # 'order' => 12,
389 # },
390 # 'reception_date_bulkmailer' => {
391 # 'struct' => 'double',
392 # 'doc' => 'The date where the message was received',
393 # 'order' => 13,
394 # },
395 # 'delivery_date_bulkmailer' => {
396 # 'struct' => 'int(11)',
397 # 'doc' => 'The date the message was sent',
398 # 'order' => 14,
399 # },
400 # 'lock_bulkmailer' => {
401 # 'struct' => 'varchar(30)',
402 # 'doc' =>
403 # 'A lock. It is set as process-number @ hostname so multiple bulkmailer can handle this spool',
404 # 'order' => 15,
405 # },
406 # 'tag_bulkmailer' => {
407 # 'struct' => 'varchar(10)',
408 # 'doc' => 'Additional tag used to sort packets',
409 # 'order' => 16,
410 # },
411 # },
412 # 'doc' =>
413 # 'storage of recipients with a ref to a message in spool_table. So a very simple process can distribute them',
414 # 'order' => 4,
415 #},
416 'exclusion_table' => {
417 'fields' => {
418 'list_exclusion' => {
419 # "family:" and family name.
420 'struct' => sprintf(
421 'varchar(%d)', Sympa::Constants::FAMILY_LEN() + 7
422 ),
423 'doc' => 'FIXME',
424 'order' => 1,
425 'primary' => 1,
426 'not_null' => 1,
427 },
428 'robot_exclusion' => {
429 'struct' => $robot_struct,
430 'doc' => 'FIXME',
431 'order' => 2,
432 'primary' => 1,
433 'not_null' => 1,
434 },
435 'user_exclusion' => {
436 'struct' => $email_struct,
437 'doc' => 'FIXME',
438 'order' => 3,
439 'primary' => 1,
440 'not_null' => 1,
441 },
442 'family_exclusion' => {
443 'struct' => $family_struct,
444 'doc' => 'FIXME',
445 'primary' => 1,
446 'order' => 4,
447 },
448 'date_exclusion' => {
449 'struct' => 'int(11)',
450 'doc' => 'FIXME',
451 'order' => 5,
452 },
453 },
454 'doc' =>
455 'Exclusion table is used in order to manage unsubscription for subscriber included from an external data source.',
456 'order' => 5,
457 },
458 'inclusion_table' => {
459 'fields' => {
460 'target_inclusion' => {
461 'struct' => $list_id_struct,
462 'doc' => 'list ID of including list',
463 'order' => 1,
464 'primary' => 1,
465 'not_null' => 1,
466 },
467 'role_inclusion' => {
468 'struct' => "enum('member','owner','editor')",
469 'doc' => 'role of included user',
470 'order' => 2,
471 'primary' => 1,
472 'not_null' => 1,
473 },
474 'source_inclusion' => {
475 'struct' => $list_id_struct,
476 'doc' => 'list ID of included list',
477 'order' => 3,
478 'primary' => 1,
479 'not_null' => 1,
480 },
481 'update_epoch_inclusion' => {
482 'struct' => 'int(11)',
483 'doc' => 'the date this entry was created or updated',
484 'order' => 4,
485 },
486 },
487 'doc' =>
488 'Inclusion table is used in order to manage lists included from / including subscribers of other lists.',
489 'order' => 4,
490 },
491 'session_table' => {
492 'fields' => {
493 'id_session' => {
494 'struct' => 'varchar(30)',
495 'doc' => 'the identifier of the database record',
496 'primary' => 1,
497 'not_null' => 1,
498 'order' => 1,
499 },
500 'prev_id_session' => {
501 'struct' => 'varchar(30)',
502 'doc' => 'previous identifier of the database record',
503 'order' => 2,
504 },
505 'start_date_session' => {
506 'struct' => 'int(11)',
507 'doc' => 'the date when the session was created',
508 'not_null' => 1,
509 'order' => 3,
510 },
511 'date_session' => {
512 'struct' => 'int(11)',
513 'doc' =>
514 'Unix time of the last use of this session. It is used in order to expire old sessions',
515 'not_null' => 1,
516 'order' => 4,
517 },
518 'refresh_date_session' => {
519 'struct' => 'int(11)',
520 'doc' =>
521 'Unix time of the last refresh of this session. It is used in order to refresh available sessions',
522 'order' => 5,
523 },
524 'remote_addr_session' => {
525 'struct' => 'varchar(60)',
526 'doc' =>
527 'the IP address of the computer from which the session was created',
528 'order' => 6,
529 },
530 'robot_session' => {
531 'struct' => $robot_struct,
532 'doc' => 'the virtual host in which the session was created',
533 'order' => 7,
534 },
535 'email_session' => {
536 'struct' => $email_struct,
537 'doc' => 'the email associated to this session',
538 'order' => 8,
539 },
540 'hit_session' => {
541 'struct' => 'int(11)',
542 'doc' =>
543 'the number of hit performed during this session. Used to detect crawlers',
544 'order' => 9,
545 },
546 'data_session' => {
547 'struct' => 'text',
548 'doc' =>
549 'parameters attached to this session that don\'t have a dedicated column in the database',
550 'order' => 10,
551 },
552 },
553 'doc' => 'Management of HTTP session.',
554 'order' => 6,
555 },
556 'one_time_ticket_table' => {
557 'fields' => {
558 'ticket_one_time_ticket' => {
559 'struct' => 'varchar(30)',
560 'doc' => 'FIXME',
561 'primary' => 1,
562 'order' => 1,
563 },
564 'email_one_time_ticket' => {
565 'struct' => $email_struct,
566 'doc' => 'FIXME',
567 'order' => 2,
568 },
569 'robot_one_time_ticket' => {
570 'struct' => $robot_struct,
571 'doc' => 'FIXME',
572 'order' => 3,
573 },
574 'date_one_time_ticket' => {
575 'struct' => 'int(11)',
576 'doc' => 'FIXME',
577 'order' => 4,
578 },
579 'data_one_time_ticket' => {
580 'struct' => 'varchar(200)',
581 'doc' => 'FIXME',
582 'order' => 5,
583 },
584 'remote_addr_one_time_ticket' => {
585 'struct' => 'varchar(60)',
586 'doc' => 'FIXME',
587 'order' => 6,
588 },
589 'status_one_time_ticket' => {
590 'struct' => 'varchar(60)',
591 'doc' => 'FIXME',
592 'order' => 7,
593 },
594 },
595 'doc' =>
596 'One time ticket are random value used for authentication challenge. A ticket is associated with a context which look like a session.',
597 'order' => 7,
598 },
599 'notification_table' => {
600 'fields' => {
601 'pk_notification' => {
602 'struct' => 'bigint(20)',
603 'doc' => 'autoincrement key',
604 'autoincrement' => 1,
605 'primary' => 1,
606 'not_null' => 1,
607 'order' => 1,
608 },
609 'message_id_notification' => {
610 'struct' => 'varchar(100)',
611 'doc' =>
612 'initial message-id. This field is used to search DSN and MDN related to a particular message',
613 'order' => 2,
614 },
615 'recipient_notification' => {
616 'struct' => $email_struct,
617 'doc' =>
618 'email address of recipient for which a DSN or MDN was received',
619 'order' => 3,
620 },
621 'reception_option_notification' => {
622 'struct' => 'varchar(20)',
623 'doc' =>
624 'the subscription option of the subscriber when the related message was sent to the list. Useful because some recipient may have option such as //digest// or //nomail//',
625 'order' => 4,
626 },
627 'status_notification' => {
628 'struct' => 'varchar(100)',
629 'doc' => 'value of notification',
630 'order' => 5,
631 },
632 'arrival_date_notification' => {
633 'struct' => 'varchar(80)',
634 'doc' => 'reception date of latest DSN or MDN',
635 'order' => 6,
636 },
637 'arrival_epoch_notification' => {
638 'struct' => 'int(11)',
639 'doc' => 'reception date of latest DSN or MDN',
640 'order' => 7,
641 },
642 'type_notification' => {
643 'struct' => "enum('DSN', 'MDN')",
644 'doc' => 'type of the notification (DSN or MDN)',
645 'order' => 8,
646 },
647 'list_notification' => {
648 'struct' => $list_struct,
649 'doc' => 'the listname the message was issued for',
650 'order' => 9,
651 },
652 'robot_notification' => {
653 'struct' => $robot_struct,
654 'doc' => 'the robot the message is related to',
655 'order' => 10,
656 },
657 'date_notification' => {
658 'struct' => 'int(11)',
659 'doc' => 'FIXME',
660 'not_null' => 1,
661 'order' => 11,
662 },
663 },
664 'doc' =>
665 'Used for message tracking feature. If the list is configured for tracking, outgoing messages include a delivery status notification request and optionally a message disposition notification request. When DSN and MDN are received by Sympa, they are stored in this table in relation with the related list and message ID.',
666 'order' => 8,
667 },
668 'logs_table' => {
669 'fields' => {
670 #'id_logs' => {
671 # 'struct' => 'bigint(20)',
672 # 'doc' => 'unique log\'s identifier',
673 # 'primary' => 1,
674 # 'not_null' => 1,
675 # 'order' => 1,
676 #},
677 'user_email_logs' => {
678 'struct' => $email_struct,
679 'doc' =>
680 'e-mail address of the message sender or email of identified web interface user (or soap user)',
681 'order' => 2,
682 },
683 'date_logs' => {
684 'struct' => 'int(11)',
685 'doc' => 'date when the action was executed',
686 'not_null' => 1,
687 'order' => 3,
688 },
689 'usec_logs' => {
690 'struct' => 'int(6)',
691 'doc' =>
692 'subsecond in microsecond when the action was executed',
693 'order' => 3.5,
694 },
695 'robot_logs' => {
696 'struct' => $robot_struct,
697 'doc' =>
698 'name of the robot in which context the action was executed',
699 'order' => 4,
700 },
701 'list_logs' => {
702 'struct' => $list_struct,
703 'doc' =>
704 'name of the mailing-list in which context the action was executed',
705 'order' => 5,
706 },
707 'action_logs' => {
708 'struct' => 'varchar(50)',
709 'doc' =>
710 'name of the Sympa subroutine which initiated the log',
711 'not_null' => 1,
712 'order' => 6,
713 },
714 'parameters_logs' => {
715 'struct' => 'varchar(100)',
716 'doc' =>
717 'comma-separated list of parameters. The amount and type of parameters can differ from an action to another',
718 'order' => 7,
719 },
720 'target_email_logs' => {
721 'struct' => $email_struct,
722 'doc' => 'e-mail address (if any) targeted by the message',
723 'order' => 8,
724 },
725 'msg_id_logs' => {
726 'struct' => 'varchar(255)',
727 'doc' =>
728 'identifier of the message which triggered the action',
729 'order' => 9,
730 },
731 'status_logs' => {
732 'struct' => 'varchar(10)',
733 'doc' =>
734 'exit status of the action. If it was an error, it is likely that the error_type_logs field will contain a description of this error',
735 'not_null' => 1,
736 'order' => 10,
737 },
738 'error_type_logs' => {
739 'struct' => 'varchar(150)',
740 'doc' =>
741 'name of the error string - if any - issued by the subroutine',
742 'order' => 11,
743 },
744 'client_logs' => {
745 'struct' => 'varchar(100)',
746 'doc' =>
747 'IP address of the client machine from which the message was sent',
748 'order' => 12,
749 },
750 'daemon_logs' => {
751 'struct' => 'varchar(10)',
752 'doc' => 'name of the Sympa daemon which ran the action',
753 'not_null' => 1,
754 'order' => 13,
755 },
756 },
757 'doc' =>
758 'Each important event is stored in this table. List owners and listmaster can search entries in this table using web interface.',
759 'order' => 9,
760 },
761 'stat_table' => {
762 'fields' => {
763 #'id_stat' => {
764 # 'struct' => 'bigint(20)',
765 # 'doc' => 'FIXME',
766 # 'order' => 1,
767 # 'primary' => 1,
768 # 'not_null' => 1,
769 #},
770 'date_stat' => {
771 'struct' => 'int(11)',
772 'doc' => 'FIXME',
773 'order' => 2,
774 'not_null' => 1,
775 },
776 'email_stat' => {
777 'struct' => $email_struct,
778 'doc' => 'FIXME',
779 'order' => 3,
780 },
781 'operation_stat' => {
782 'struct' => 'varchar(50)',
783 'doc' => 'FIXME',
784 'order' => 4,
785 'not_null' => 1,
786 },
787 'list_stat' => {
788 'struct' => $list_struct,
789 'doc' => 'FIXME',
790 'order' => 5,
791 },
792 'daemon_stat' => {
793 'struct' => 'varchar(20)',
794 'doc' => 'FIXME',
795 'order' => 6,
796 },
797 'user_ip_stat' => {
798 'struct' => 'varchar(100)',
799 'doc' => 'FIXME',
800 'order' => 7,
801 },
802 'robot_stat' => {
803 'struct' => $robot_struct,
804 'doc' => 'FIXME',
805 'order' => 8,
806 'not_null' => 1,
807 },
808 'parameter_stat' => {
809 'struct' => 'varchar(50)',
810 'doc' => 'FIXME',
811 'order' => 9,
812 },
813 'read_stat' => {
814 'struct' => 'tinyint(1)',
815 'doc' => 'FIXME',
816 'order' => 10,
817 'not_null' => 1,
818 },
819 },
820 'doc' =>
821 'Statistics item are stored in this table, Sum average and so on are stored in stat_counter_table.',
822 'order' => 10,
823 },
824 'stat_counter_table' => {
825 'fields' => {
826 #'id_counter' => {
827 # 'struct' => 'bigint(20)',
828 # 'doc' => 'FIXME',
829 # 'order' => 1,
830 # 'primary' => 1,
831 # 'not_null' => 1,
832 #},
833 'beginning_date_counter' => {
834 'struct' => 'int(11)',
835 'doc' => 'FIXME',
836 'order' => 2,
837 'not_null' => 1,
838 },
839 'end_date_counter' => {
840 'struct' => 'int(11)',
841 'doc' => 'FIXME',
842 'order' => 1,
843 },
844 'data_counter' => {
845 'struct' => 'varchar(50)',
846 'doc' => 'FIXME',
847 'not_null' => 1,
848 'order' => 3,
849 },
850 'robot_counter' => {
851 'struct' => $robot_struct,
852 'doc' => 'FIXME',
853 'not_null' => 1,
854 'order' => 4,
855 },
856 'list_counter' => {
857 'struct' => $list_struct,
858 'doc' => 'FIXME',
859 'order' => 5,
860 },
861 #'variation_counter' => {
862 # 'struct' => 'int',
863 # 'doc' => 'FIXME',
864 # 'order' => 6,
865 #},
866 #'total_counter' => {
867 # 'struct' => 'int',
868 # 'doc' => 'FIXME',
869 # 'order' => 7,
870 #},
871 'count_counter' => {
872 'struct' => 'int',
873 'doc' => 'FIXME',
874 'order' => 8,
875 },
876 },
877 'doc' => 'Used in conjunction with stat_table for users statistics.',
878 'order' => 11,
879 },
880
881 'admin_table' => {
882 'fields' => {
883
884 'user_admin' => {
885 'struct' => $email_struct,
886 'primary' => 1,
887 'not_null' => 1,
888 'doc' => 'list admin email',
889 'order' => 1,
890 },
891 'list_admin' => {
892 'struct' => $list_struct,
893 'primary' => 1,
894 'not_null' => 1,
895 'doc' => 'list name',
896 'order' => 2,
897 },
898 'robot_admin' => {
899 'struct' => $robot_struct,
900 'primary' => 1,
901 'not_null' => 1,
902 'doc' => 'list domain',
903 'order' => 3,
904 },
905 'role_admin' => {
906 'struct' => "enum('listmaster','owner','editor')",
907 'primary' => 1,
908 'doc' =>
909 'a role of this user for this list (editor, owner or listmaster which a kind of list owner too)',
910 'order' => 4,
911 },
912 'profile_admin' => {
913 'struct' => "enum('privileged','normal')",
914 'doc' =>
915 'privilege level for this owner, value //normal// or //privileged//. The related privilege are listed in edit_list.conf. ',
916 'order' => 5,
917 },
918 #'date_admin' => {
919 # 'struct' => 'datetime',
920 # 'doc' => 'date this user become a list admin',
921 # 'not_null' => 1,
922 # 'order' => 6,
923 #},
924 'date_epoch_admin' => {
925 'struct' => 'int(11)',
926 'doc' => 'date this user become a list admin',
927 'not_null' => 1,
928 'order' => 6.5,
929 },
930 # Obsoleted as of 6.2.25b.2. Use update_epoch_admin.
931 #'update_admin' => {
932 # 'struct' => 'datetime',
933 # 'doc' => 'last update timestamp',
934 # 'order' => 7,
935 #},
936 'update_epoch_admin' => {
937 'struct' => 'int(11)',
938 'doc' => 'last update time',
939 'order' => 7.5,
940 },
941 'inclusion_admin' => {
942 'struct' => 'int(11)',
943 'doc' =>
944 'the last time when list user is synchronized with data source',
945 'order' => 7.6,
946 },
947 'inclusion_ext_admin' => {
948 'struct' => 'int(11)',
949 'doc' =>
950 'the last time when list user is synchronized with external data source',
951 'order' => 7.7,
952 },
953 'inclusion_label_admin' => {
954 'struct' => 'varchar(50)',
955 'doc' => 'name of data source',
956 'order' => 7.8,
957 },
958 'reception_admin' => {
959 'struct' => 'varchar(20)',
960 'doc' =>
961 'email reception option for list management messages',
962 'order' => 8,
963 },
964 'visibility_admin' => {
965 'struct' => 'varchar(20)',
966 'doc' =>
967 'admin user email can be hidden in the list web page description',
968 'order' => 9,
969 },
970 'comment_admin' => {
971 'struct' => 'varchar(150)',
972 'doc' => 'FIXME',
973 'order' => 10,
974 },
975 'subscribed_admin' => {
976 'struct' => 'int(1)',
977 'doc' =>
978 'set to 1 if user is list admin by definition in list config file',
979 'order' => 11,
980 },
981 # Obsoleted as of 6.2.45b. Use inclusion_admin.
982 #'included_admin' => {
983 # 'struct' => 'int(1)',
984 # 'doc' =>
985 # 'set to 1 if user is admin by an external data source. Note that included_admin and subscribed_admin can both value 1',
986 # 'order' => 12,
987 #},
988 # Ditto.
989 #'include_sources_admin' => {
990 # 'struct' => 'varchar(50)',
991 # 'doc' => 'name of external datasource',
992 # 'order' => 13,
993 #},
994 'info_admin' => {
995 'struct' => 'varchar(150)',
996 'doc' =>
997 'private information usually dedicated to listmasters who needs some additional information about list owners',
998 'order' => 14,
999 },
1000
1001 },
1002 'doc' =>
1003 'This table is an internal cash where list admin roles are stored. It is just a cash and it does not need to be saved. You may remove its content if needed. It will just make next Sympa startup slower.',
1004 'order' => 12,
1005 },
1006 'netidmap_table' => {
1007 'fields' => {
1008 'netid_netidmap' => {
1009 'struct' => 'varchar(100)',
1010 'doc' => 'FIXME',
1011 'primary' => 1,
1012 'not_null' => 1,
1013 'order' => 1,
1014 },
1015 'serviceid_netidmap' => {
1016 'struct' => 'varchar(100)',
1017 'doc' => 'FIXME',
1018 'primary' => 1,
1019 'not_null' => 1,
1020 'order' => 2,
1021 },
1022 'email_netidmap' => {
1023 'struct' => $email_struct,
1024 'doc' => 'FIXME',
1025 'order' => 4,
1026 },
1027 'robot_netidmap' => {
1028 'struct' => $robot_struct,
1029 'doc' => 'FIXME',
1030 'primary' => 1,
1031 'not_null' => 1,
1032 'order' => 3,
1033 },
1034 },
1035 'order' => 13,
1036 'doc' => 'FIXME',
1037 },
1038 'conf_table' => {
1039 'fields' => {
1040 'robot_conf' => {
1041 'struct' => $robot_struct,
1042 'doc' => 'FIXME',
1043 'primary' => 1,
1044 'order' => 1,
1045 },
1046 'label_conf' => {
1047 'struct' => 'varchar(80)',
1048 'doc' => 'FIXME',
1049 'primary' => 1,
1050 'order' => 2,
1051 },
1052 'value_conf' => {
1053 'struct' => 'varchar(300)',
1054 'doc' =>
1055 'the value of parameter //label_conf// of robot //robot_conf//.',
1056 'order' => 3,
1057 },
1058 },
1059 'doc' => 'FIXME',
1060 'order' => 14,
1061 },
1062 'list_table' => {
1063 'fields' => {
1064 ## Identification
1065 'name_list' => => {
1066 'struct' => $list_struct,
1067 'doc' => 'name of the list',
1068 'order' => 1,
1069 'primary' => 1,
1070 'not_null' => 1,
1071 },
1072 'robot_list' => {
1073 'struct' => $robot_struct,
1074 'doc' => 'name of the robot (domain) the list belongs to',
1075 'order' => 2,
1076 'primary' => 1,
1077 'not_null' => 1,
1078 },
1079 ## basic profile
1080 'family_list' => {
1081 'struct' => $family_struct,
1082 'doc' => 'name of the family the list belongs to',
1083 'order' => 3,
1084 },
1085 'status_list' => {
1086 'struct' =>
1087 "enum('open','closed','pending','error_config','family_closed')",
1088 'doc' => 'status of the list',
1089 'order' => 4,
1090 },
1091 'creation_email_list' => {
1092 'struct' => $email_struct,
1093 'doc' => 'email of user who created the list',
1094 'order' => 5,
1095 },
1096 'creation_epoch_list' => {
1097 'struct' => 'int(11)',
1098 'doc' => 'UNIX time when the list was created',
1099 'order' => 6,
1100 },
1101 'update_email_list' => {
1102 'struct' => $email_struct,
1103 'doc' => 'email of user who updated the list',
1104 'order' => 7,
1105 },
1106 'update_epoch_list' => {
1107 'struct' => 'int(11)',
1108 'doc' => 'UNIX time when the list was updated',
1109 'order' => 8,
1110 },
1111 ## Other indices to help searching lists
1112 'searchkey_list' => {
1113 'struct' => 'varchar(255)',
1114 'doc' => 'case-folded list subject to help searching',
1115 'order' => 10,
1116 },
1117 'web_archive_list' => {
1118 'struct' => 'tinyint(1)',
1119 'doc' => 'if the list has archives',
1120 'order' => 11,
1121 },
1122 'topics_list' => {
1123 'struct' => 'varchar(255)',
1124 'doc' =>
1125 'topics of the list, separated and enclosed by commas',
1126 'order' => 12,
1127 },
1128 ## total cache
1129 'total_list' => {
1130 'struct' => 'int(7)',
1131 'doc' => 'estimated number of subscribers',
1132 'order' => 90,
1133 },
1134# ## cache management
1135# 'cache_epoch_list' => {
1136# 'struct' => 'int(11)',
1137# 'doc' => 'UNIX time of cache entry',
1138# 'order' => 98,
1139# },
1140# ## admin cache
1141# 'config_list' => {
1142# 'struct' => 'mediumblob',
1143# 'doc' => 'Serialized list config',
1144# 'order' => 99,
1145# },
1146 },
1147 'doc' =>
1148 'The list_table holds cached list config and some items to help searching lists.',
1149 'order' => 18,
1150 },
1151);
1152
1153sub full_db_struct {
1154 return %full_db_struct;
1155}
1156
1157# OBSOLETED. Use Sympa::DatabaseManager::_db_struct().
1158#sub db_struct;
1159
1160sub not_null {
1161 my %not_null;
1162 my %full_db_struct = full_db_struct();
1163
1164 foreach my $table (keys %full_db_struct) {
1165 foreach my $field (keys %{$full_db_struct{$table}{'fields'}}) {
1166 $not_null{'$field'} =
1167 $full_db_struct{$table}{'fields'}{$field}{'not_null'};
1168 }
1169 }
1170 return %not_null;
1171}
1172
1173sub autoincrement {
1174 my %autoincrement;
1175 my %full_db_struct = full_db_struct();
1176
1177 foreach my $table (keys %full_db_struct) {
1178 foreach my $field (keys %{$full_db_struct{$table}{'fields'}}) {
1179 $autoincrement{$table} = $field
1180 if (
1181 $full_db_struct{$table}{'fields'}{$field}{'autoincrement'});
1182 }
1183 }
1184 return %autoincrement;
1185}
1186
1187sub primary {
1188 my %primary;
1189 my %full_db_struct = full_db_struct();
1190
1191 foreach my $table (keys %full_db_struct) {
1192 my @primarykey;
1193 foreach my $field (keys %{$full_db_struct{$table}{'fields'}}) {
1194 push(@primarykey, $field)
1195 if ($full_db_struct{$table}{'fields'}{$field}{'primary'});
1196 }
1197
1198 $primary{$table} = \@primarykey;
1199 }
1200 return %primary;
1201}
1202
1203## List the required INDEXES
1204## 1st key is the concerned table
1205## 2nd key is the index name
1206## the table lists the field on which the index applies
1207our %indexes = (
1208 'admin_table' => {'admin_user_index' => ['user_admin']},
1209 'subscriber_table' => {'subscriber_user_index' => ['user_subscriber']},
1210 'stat_table' => {'stats_user_index' => ['email_stat']},
1211 'session_table' => {'session_prev_id_index' => ['prev_id_session']},
1212);
1213
1214# table indexes that can be removed during upgrade process
1215our @former_indexes = (
1216 'user_subscriber', 'list_subscriber',
1217 'subscriber_idx', 'admin_idx',
1218 'netidmap_idx', 'user_admin',
1219 'list_admin', 'role_admin',
1220 'admin_table_index', 'logs_table_index',
1221 'netidmap_table_index', 'subscriber_table_index',
1222 'user_index'
1223);
1224
12251;
1226__END__