summaryrefslogtreecommitdiff
path: root/admin/schema_inc.php
blob: 4210e866fa6cb714b4b9ca3af2a63244fc14b736 (plain)
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<?php

$tables = array(

'tiki_actionlog' => "
	page_id I4 NOTNULL,
	user_id I4 NOTNULL,
	action C(255) NOTNULL,
	last_modified I8,
	title C(160),
	ip C(15),
	comment C(200)
",

'tiki_copyrights' => "
	copyright_id I4 AUTO PRIMARY,
	page_id I4 NOTNULL,
	title C(200),
	year I8,
	authors C(200),
	copyright_order I8,
	user_id I4
",

'tiki_history' => "
	page_id I4 PRIMARY,
	version I4 PRIMARY,
	last_modified I8 NOTNULL,
	format_guid C(16) NOTNULL,
	description C(200),
	user_id C(40),
	ip C(15),
	comment C(200),
	data X
	CONSTRAINTS ', CONSTRAINT `tiki_history_page_ref` FOREIGN KEY (`page_id`) REFERENCES `".BIT_DB_PREFIX."tiki_pages`( `page_id` )'
",

'tiki_links' => "
	from_content_id I4 PRIMARY,
	to_content_id I4 PRIMARY
",

'tiki_page_footnotes' => "
	user_id C(40) PRIMARY,
	page_id I4 NOTNULL,
	data X
",

'tiki_pages' => "
	page_id I4 PRIMARY,
	content_id I4 NOTNULL,
	version I4 NOTNULL,
	page_size I4 DEFAULT 0,
	description C(200),
	comment C(200),
	flag C(1),
	points I4,
	votes I4,
	cache X,
	wiki_cache I8,
	cache_timestamp I8,
	page_rank N(4,3)
",

'tiki_received_pages' => "
	received_page_id I4 AUTO PRIMARY,
	title C(160) NOTNULL,
	data X,
	description C(200),
	comment C(200),
	received_from_site C(200),
	received_from_user C(200),
	received_date I8
",

'tiki_tags' => "
	page_id I4 PRIMARY,
	tag_name C(80) PRIMARY,
	title C(160),
	user_id I4 NOTNULL,
	hits I4,
	description C(200),
	data X,
	last_modified I8,
	comment C(200),
	version I4 NOTNULL,
	ip C(15),
	flag C(1)
",

'tiki_extwiki' => "
	extwiki_id I4 AUTO PRIMARY,
	name C(200) NOTNULL,
	extwiki C(255)
"

);

global $gBitInstaller;

$gBitInstaller->makePackageHomeable(WIKI_PKG_NAME);

foreach( array_keys( $tables ) AS $tableName ) {
	$gBitInstaller->registerSchemaTable( WIKI_PKG_NAME, $tableName, $tables[$tableName] );
}

$gBitInstaller->registerPackageInfo( WIKI_PKG_NAME, array(
	'description' => "A wiki is 'the simplest online database that could possibly work.' No HTML or programming knowledge is needed to contribute to a wiki.",
	'license' => '<a href="http://www.gnu.org/licenses/licenses.html#LGPL">LGPL</a>',
	'version' => '0.1',
	'state' => 'experimental',
	'dependencies' => '',
) );

// ### Indexes
$indices = array (
	'tiki_pages_content_idx' => array( 'table' => 'tiki_pages', 'cols' => 'content_id', 'opts' => 'UNIQUE' ),
	'tiki_pages_page_rank_idx' => array( 'table' => 'tiki_pages', 'cols' => 'page_rank', 'opts' => NULL ),
	'tiki_page_footnotes_page_idx' => array( 'table' => 'tiki_page_footnotes', 'cols' => 'page_id', 'opts' => NULL )
);
$gBitInstaller->registerSchemaIndexes( WIKI_PKG_NAME, $indices );

// ### Sequences
$sequences = array (
	'tiki_pages_page_id_seq' => array( 'start' => 1 )
);
$gBitInstaller->registerSchemaSequences( WIKI_PKG_NAME, $sequences );


// ### Default UserPermissions
$gBitInstaller->registerUserPermissions( WIKI_PKG_NAME, array(
	array('bit_p_edit_dynvar', 'Can edit dynamic variables', 'editors', WIKI_PKG_NAME),
	array('bit_p_edit', 'Can edit pages', 'registered', WIKI_PKG_NAME),
	array('bit_p_view', 'Can view page/pages', 'basic', WIKI_PKG_NAME),
	array('bit_p_remove', 'Can remove', 'editors', WIKI_PKG_NAME),
	array('bit_p_rollback', 'Can rollback pages', 'editors', WIKI_PKG_NAME),
	array('bit_p_admin_wiki', 'Can admin the wiki', 'editors', WIKI_PKG_NAME),
	array('bit_p_wiki_admin_attachments', 'Can admin attachments to wiki pages', 'editors', WIKI_PKG_NAME),
	array('bit_p_wiki_view_attachments', 'Can view wiki attachments and download', 'registered', WIKI_PKG_NAME),
	array('bit_p_upload_picture', 'Can upload pictures to wiki pages', 'registered', WIKI_PKG_NAME),
	array('bit_p_minor', 'Can save as minor edit', 'registered', WIKI_PKG_NAME),
	array('bit_p_rename', 'Can rename pages', 'editors', WIKI_PKG_NAME),
	array('bit_p_lock', 'Can lock pages', 'editors', WIKI_PKG_NAME),

	array('bit_p_edit_books', 'Can create and edit books', 'registered', WIKI_PKG_NAME),
	array('bit_p_admin_books', 'Can administer books', 'editors', WIKI_PKG_NAME),
	array('bit_p_edit_copyrights', 'Can edit copyright notices', 'registered', WIKI_PKG_NAME)
) );

// ### Default Preferences
$gBitInstaller->registerPreferences( WIKI_PKG_NAME, array(
	array( WIKI_PKG_NAME, 'anonCanEdit','n'),
	array( WIKI_PKG_NAME, 'feature_autolinks','y'),
	array( WIKI_PKG_NAME, 'feature_backlinks','y'),
	array( WIKI_PKG_NAME, 'feature_dump','y'),
	array( WIKI_PKG_NAME, 'feature_history','y'),
	array( WIKI_PKG_NAME, 'feature_lastChanges','y'),
	array( WIKI_PKG_NAME, 'feature_likePages','y'),
	array( WIKI_PKG_NAME, 'feature_allow_dup_wiki_page_names','y'),
	array( WIKI_PKG_NAME, 'feature_listPages','y'),
	array( WIKI_PKG_NAME, 'feature_page_title','y'),
	array( WIKI_PKG_NAME, 'feature_ranking','n'),
	array( WIKI_PKG_NAME, 'feature_sandbox','y'),
	array( WIKI_PKG_NAME, 'feature_warn_on_edit','n'),
	array( WIKI_PKG_NAME, 'feature_wiki','y'),
	array( WIKI_PKG_NAME, 'feature_wiki_attachments','y'),
	array( WIKI_PKG_NAME, 'feature_wiki_books','y'),
	array( WIKI_PKG_NAME, 'feature_wiki_comments','n'),
	array( WIKI_PKG_NAME, 'feature_wiki_description','y'),
	array( WIKI_PKG_NAME, 'feature_wiki_discuss','n'),
	array( WIKI_PKG_NAME, 'feature_wiki_footnotes','n'),
	array( WIKI_PKG_NAME, 'feature_wiki_icache','n'),
	array( WIKI_PKG_NAME, 'feature_wiki_monosp','n'),
	array( WIKI_PKG_NAME, 'feature_wiki_multiprint','n'),
	array( WIKI_PKG_NAME, 'feature_wiki_notepad','n'),
	array( WIKI_PKG_NAME, 'feature_wiki_generate_pdf',''),
	array( WIKI_PKG_NAME, 'feature_wiki_pictures','y'),
	array( WIKI_PKG_NAME, 'feature_wiki_plurals','y'),
	array( WIKI_PKG_NAME, 'feature_wiki_rankings','y'),
	array( WIKI_PKG_NAME, 'feature_wiki_tables','new'),
	array( WIKI_PKG_NAME, 'feature_wiki_templates','n'),
	array( WIKI_PKG_NAME, 'feature_wiki_undo','n'),
	array( WIKI_PKG_NAME, 'feature_wiki_usrlock','n'),
	array( WIKI_PKG_NAME, 'feature_wikiwords','y'),
	array( WIKI_PKG_NAME, 'keep_versions','1'),
	array( WIKI_PKG_NAME, 'maxVersions','0'),
	array( WIKI_PKG_NAME, 'w_use_db','y'),
	array( WIKI_PKG_NAME, 'w_use_dir',''),
	array( WIKI_PKG_NAME, 'warn_on_edit_time','2'),
	array( WIKI_PKG_NAME, 'wiki_bot_bar','n'),
	array( WIKI_PKG_NAME, 'wiki_cache','0'),
	array( WIKI_PKG_NAME, 'wiki_creator_admin','n'),
	array( WIKI_PKG_NAME, 'wiki_feature_copyrights','n'),
	array( WIKI_PKG_NAME, 'wiki_forum',''),
	array( WIKI_PKG_NAME, 'wiki_forum_id',''),
	array( WIKI_PKG_NAME, 'wiki_left_column','y'),
	array( WIKI_PKG_NAME, 'wiki_list_backlinks','y'),
	array( WIKI_PKG_NAME, 'wiki_list_comment','y'),
	array( WIKI_PKG_NAME, 'wiki_list_creator','y'),
	array( WIKI_PKG_NAME, 'wiki_list_hits','y'),
	array( WIKI_PKG_NAME, 'wiki_list_lastmodif','y'),
	array( WIKI_PKG_NAME, 'wiki_list_lastver','y'),
	array( WIKI_PKG_NAME, 'wiki_list_links','y'),
	array( WIKI_PKG_NAME, 'wiki_list_name','y'),
	array( WIKI_PKG_NAME, 'wiki_list_size','y'),
	array( WIKI_PKG_NAME, 'wiki_list_status','y'),
	array( WIKI_PKG_NAME, 'wiki_list_user','y'),
	array( WIKI_PKG_NAME, 'wiki_list_versions','y'),
	array( WIKI_PKG_NAME, 'wiki_page_regex','strict'),
	array( WIKI_PKG_NAME, 'wiki_right_column','y'),
	array( WIKI_PKG_NAME, 'wiki_spellcheck','n'),
	array( WIKI_PKG_NAME, 'wiki_top_bar','n'),
	array( WIKI_PKG_NAME, 'wiki_uses_slides','n'),
	array( WIKI_PKG_NAME, 'wikibook_show_path','y'),
	array( WIKI_PKG_NAME, 'wikibook_show_navigation','y'),
	array( WIKI_PKG_NAME, 'wikiHomePage','Welcome'),
	array( WIKI_PKG_NAME, 'wikiLicensePage',''),
	array( WIKI_PKG_NAME, 'wikiSubmitNotice',''),
	array( RSS_PKG_NAME, 'rss_'.WIKI_PKG_NAME, 'y'),
) );

?>