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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
<?php
$tables = array(
'boards_posts' => "
comment_id I4 PRIMARY,
is_approved I1 NOTNULL DEFAULT(0),
is_warned I1 NOTNULL DEFAULT(0),
warned_message X,
migrate_post_id INT
CONSTRAINT ', CONSTRAINT `boards_posts_comment_ref` FOREIGN KEY (`comment_id`) REFERENCES `".BIT_DB_PREFIX."liberty_comments` (`comment_id`)'
",
'boards_topics' => "
parent_id I4 PRIMARY,
is_locked I1 NOTNULL DEFAULT(0),
is_moved I4 NOTNULL DEFAULT(0),
is_sticky I1 NOTNULL DEFAULT(0),
migrate_topic_id INT
CONSTRAINT ', CONSTRAINT `boards_topics_parent_ref` FOREIGN KEY (`parent_id`) REFERENCES `".BIT_DB_PREFIX."liberty_content` (`content_id`)'
",
'boards_sections' => "
section_id I4 PRIMARY,
section_title C(255)
",
'boards' => "
board_id I4 PRIMARY,
content_id I4 NOTNULL,
section_id I4,
pos I4,
migrate_board_id INT
CONSTRAINT ', CONSTRAINT `boards_content_ref` FOREIGN KEY (`content_id`) REFERENCES `".BIT_DB_PREFIX."liberty_content` (`content_id`)
, CONSTRAINT `boards_section_ref` FOREIGN KEY (`section_id`) REFERENCES `".BIT_DB_PREFIX."boards_sections` (`section_id`)'
",
'boards_map' => "
board_content_id I4 NOTNULL,
topic_content_id I4 PRIMARY
CONSTRAINT ', CONSTRAINT `boards_topics_boards_ref` FOREIGN KEY (`board_content_id`) REFERENCES `".BIT_DB_PREFIX."liberty_content` (`content_id`)
, CONSTRAINT `boards_topics_related_ref` FOREIGN KEY (`topic_content_id`) REFERENCES `".BIT_DB_PREFIX."liberty_content` (`content_id`)'
",
'boards_tracking' => "
user_id I4 NOTNULL,
topic_id C(10),
track_date I4 NOTNULL DEFAULT(0),
notify I1 NOTNULL DEFAULT(0),
notify_date I4 NOTNULL DEFAULT(0)
"
);
global $gBitInstaller;
foreach( array_keys( $tables ) AS $tableName ) {
$gBitInstaller->registerSchemaTable( BOARDS_PKG_NAME, $tableName, $tables[$tableName] );
}
$gBitInstaller->registerPackageInfo( BOARDS_PKG_NAME, array(
'description' => "Highly integrated message boards package.",
'license' => '<a href="http://www.gnu.org/licenses/licenses.html#LGPL">LGPL</a>',
) );
// ### Indexes
$indices = array(
'boards_id_idx' => array('table' => 'boards', 'cols' => 'board_id', 'opts' => NULL ),
);
$gBitInstaller->registerSchemaIndexes( BOARDS_PKG_NAME, $indices );
// ### Sequences
$sequences = array (
'boards_board_id_seq' => array( 'start' => 1 ),
'boards_sections_id_seq' => array( 'start' => 1 ),
);
$gBitInstaller->registerSchemaSequences( BOARDS_PKG_NAME, $sequences );
// ### Default UserPermissions
$gBitInstaller->registerUserPermissions( BOARDS_PKG_NAME, array(
array( 'p_boards_admin' , 'Can admin message boards' , 'admin' , BOARDS_PKG_NAME ),
array( 'p_boards_create', 'Can create a message board', 'editors', BOARDS_PKG_NAME ),
array( 'p_boards_post_update', 'Can update any post', 'editors', BOARDS_PKG_NAME ),
array( 'p_boards_update' , 'Can update any message board', 'editors', BOARDS_PKG_NAME ),
array( 'p_boards_read' , 'Can read message boards' , 'basic' , BOARDS_PKG_NAME ),
array( 'p_boards_remove', 'Can delete message boards' , 'editors', BOARDS_PKG_NAME ),
) );
// ### Default Preferences
$gBitInstaller->registerPreferences( BOARDS_PKG_NAME, array(
array( BOARDS_PKG_NAME, 'boards_thread_track', 'y' ),
));
if(defined('RSS_PKG_NAME')) {
$gBitInstaller->registerPreferences( BOARDS_PKG_NAME, array(
array( RSS_PKG_NAME, BOARDS_PKG_NAME.'_rss', 'y'),
));
}
// ### Register content types
$gBitInstaller->registerContentObjects( BOARDS_PKG_NAME, array(
'BitBoard'=>BOARDS_PKG_CLASS_PATH.'BitBoard.php',
));
// Requirements
$gBitInstaller->registerRequirements( BOARDS_PKG_NAME, array(
'liberty' => array( 'min' => '2.1.4' ),
));
|