1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
<?php
$tables = array(
'messu_messages' => "
msg_id I4 AUTO PRIMARY,
to_user_id I4 NOTNULL,
from_user_id I4 NOTNULL,
msg_to X,
msg_cc X,
msg_bcc X,
subject C(255),
body X,
hash C(32),
date I8,
is_read C(1),
is_replied C(1),
is_flagged C(1),
group_id I4
priority I4
",
'messu_system_message_map' => "
msg_id I4,
to_user_id I4 NOTNULL,
is_read C(1),
is_flagged C(1),
is_replied C(1),
priority I4,
is_hidden C(1)
CONSTRAINTS ', CONSTRAINT `tiki_messu_system_message_ref` FOREIGN KEY (`msg_id`) REFERENCES `".BIT_DB_PREFIX."messu_messages` (`msg_id`)'
"
// CONSTRAINT ', CONSTRAINT tiki_messu_to_user_ref FOREIGN KEY (to_user_id) REFERENCES `".BIT_DB_PREFIX."users_users` (user_id)
// , CONSTRAINT tiki_messu_from_user_ref FOREIGN KEY (from_user_id) REFERENCES `".BIT_DB_PREFIX."users_users` (user_id)'
);
global $gBitInstaller;
foreach( array_keys( $tables ) AS $tableName ) {
$gBitInstaller->registerSchemaTable( MESSU_PKG_NAME, $tableName, $tables[$tableName] );
}
$gBitInstaller->registerPackageInfo( MESSU_PKG_NAME, array(
'description' => "An intra-site messaging system for users.",
'license' => '<a href="http://www.gnu.org/licenses/licenses.html#LGPL">LGPL</a>',
'version' => '0.1',
'state' => 'beta',
'dependencies' => '',
) );
// ### Default User Permissions
$gBitInstaller->registerUserPermissions( MESSU_PKG_NAME, array(
array('bit_p_messages', 'Can use the messaging system', 'registered', 'messages'),
) );
// ### Indexes
$indices = array (
'tiki_messu_to_user_id_idx' => array( 'table' => 'messu_messages', 'cols' => 'to_user_id', 'opts' => NULL ),
'tiki_messu_from_user_id_idx' => array( 'table' => 'messu_messages', 'cols' => 'from_user_id', 'opts' => NULL )
);
// TODO - SPIDERR - following seems to cause time _decrease_ cause bigint on postgres. need more investigation
// 'tiki_blog_posts_created_idx' => array( 'table' => 'tiki_blog_posts', 'cols' => 'created', 'opts' => NULL ),
$gBitInstaller->registerSchemaIndexes( MESSU_PKG_NAME, $indices );
?>
|