summaryrefslogtreecommitdiff
path: root/admin/schema_inc.php
blob: 2ff6e8b2894bff4c1b39a365f21862e9181ec4fb (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
<?php

$tables = array(

'wiki_pages' => "
	page_id I4 PRIMARY,
	content_id I4 NOTNULL,
	wiki_page_size I4 DEFAULT 0,
	edit_comment C(200),
	flag C(1)
	CONSTRAINT ', CONSTRAINT `wiki_pages_content_ref` FOREIGN KEY (`content_id`) REFERENCES `".BIT_DB_PREFIX."liberty_content`( `content_id` )'
",

'wiki_footnotes' => "
	user_id I4 PRIMARY,
	page_id I4 NOTNULL,
	data X
	CONSTRAINT ', CONSTRAINT `wiki_footnotes_page_ref` FOREIGN KEY (`page_id`) REFERENCES `".BIT_DB_PREFIX."wiki_pages` (`page_id`)
  				, CONSTRAINT `wiki_footnotes_user_ref` FOREIGN KEY (`user_id`) REFERENCES `".BIT_DB_PREFIX."users_users` (`user_id`)'
",

);

global $gBitInstaller;

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>',
) );

// ### Indexes
$indices = array (
	'wiki_pages_content_idx' => array( 'table' => 'wiki_pages', 'cols' => 'content_id', 'opts' => 'UNIQUE' ),
	'wiki_page_footnotes_page_idx' => array( 'table' => 'wiki_footnotes', 'cols' => 'page_id', 'opts' => NULL )
);
$gBitInstaller->registerSchemaIndexes( WIKI_PKG_NAME, $indices );

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


// ### Default UserPermissions
$gBitInstaller->registerUserPermissions( WIKI_PKG_NAME, array(
	array('p_wiki_admin_book', 'Can administer books', 'editors', WIKI_PKG_NAME),
	array('p_wiki_admin', 'Can admin the wiki', 'admin', WIKI_PKG_NAME),
	array('p_wiki_update_book', 'Can edit books', 'editor', WIKI_PKG_NAME),
	array('p_wiki_create_book', 'Can create books', 'editor', WIKI_PKG_NAME),
	array('p_wiki_edit_copyright', 'Can edit copyright notices', 'editor', WIKI_PKG_NAME),
	array('p_wiki_edit_dynvar', 'Can edit dynamic variables', 'editors', WIKI_PKG_NAME),
	array('p_wiki_update_page', 'Can edit pages', 'editor', WIKI_PKG_NAME),
	array('p_wiki_create_page', 'Can create pages', 'editor', WIKI_PKG_NAME),
	array('p_wiki_list_pages', 'Can list pages', 'editor', WIKI_PKG_NAME),
	array('p_wiki_lock_page', 'Can lock pages', 'editors', WIKI_PKG_NAME),
	array('p_wiki_remove_page', 'Can remove a wiki page', 'editors', WIKI_PKG_NAME),
	array('p_wiki_rename_page', 'Can rename pages', 'editors', WIKI_PKG_NAME),
	array('p_wiki_rollback', 'Can rollback pages', 'editors', WIKI_PKG_NAME),
	array('p_wiki_save_minor', 'Can save as minor edit', 'editor', WIKI_PKG_NAME),
	array('p_wiki_view_history', 'Can view page history', 'basic', WIKI_PKG_NAME),
	array('p_wiki_view_page', 'Can view page/pages', 'basic', WIKI_PKG_NAME),
) );

// ### Default Preferences
$gBitInstaller->registerPreferences( WIKI_PKG_NAME, array(
	//array( WIKI_PKG_NAME, 'warn_on_edit','n'),
	//array( WIKI_PKG_NAME, 'wiki_allow_dup_page_names','y'),
	array( WIKI_PKG_NAME, 'wiki_attachments','y'),
	array( WIKI_PKG_NAME, 'wiki_backlinks','y'),
	array( WIKI_PKG_NAME, 'wiki_book_show_navigation','y'),
	array( WIKI_PKG_NAME, 'wiki_book_show_path','y'),
	array( WIKI_PKG_NAME, 'wiki_books','y'),
	//array( WIKI_PKG_NAME, 'wiki_comments','n'),
	//array( WIKI_PKG_NAME, 'wiki_copyrights','n'),
	//array( WIKI_PKG_NAME, 'wiki_creator_admin','n'),
	array( WIKI_PKG_NAME, 'wiki_description','y'),
	array( WIKI_PKG_NAME, 'wiki_dump','y'),
	//array( WIKI_PKG_NAME, 'wiki_footnotes','n'),
	//array( WIKI_PKG_NAME, 'wiki_hide_date','n'),
	array( WIKI_PKG_NAME, 'wiki_history','y'),
	array( WIKI_PKG_NAME, 'wiki_home_page','Welcome'),
	array( WIKI_PKG_NAME, 'wiki_last_changes','y'),
	//array( WIKI_PKG_NAME, 'wiki_license_page',''),
	array( WIKI_PKG_NAME, 'wiki_like_pages','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_format_guid',''),
	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_orphans','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_monosp','n'),
	//array( WIKI_PKG_NAME, 'wiki_multiprint','n'),
	array( WIKI_PKG_NAME, 'wiki_page_regex','strict'),
	array( WIKI_PKG_NAME, 'wiki_page_title','y'),
	array( WIKI_PKG_NAME, 'wiki_pictures','y'),
	array( WIKI_PKG_NAME, 'wiki_plurals','y'),
	//array( WIKI_PKG_NAME, 'wiki_preserve_leading_blanks','n'),
	//array( WIKI_PKG_NAME, 'wiki_ranking','n'),
	array( WIKI_PKG_NAME, 'wiki_rankings','y'),
	//array( WIKI_PKG_NAME, 'wiki_section_edit','n'),
	//array( WIKI_PKG_NAME, 'wiki_submit_notice',''),
	array( WIKI_PKG_NAME, 'wiki_tables','new'),
	//array( WIKI_PKG_NAME, 'wiki_undo','n'),
	//array( WIKI_PKG_NAME, 'wiki_url_import','n'),
	//array( WIKI_PKG_NAME, 'wiki_user_versions','n'),
	//array( WIKI_PKG_NAME, 'wiki_uses_slides','n'),
	//array( WIKI_PKG_NAME, 'wiki_usrlock','n'),
	array( WIKI_PKG_NAME, 'wiki_warn_on_edit_time','2'),
	//array( WIKI_PKG_NAME, 'wiki_watch_author','n'),
	//array( WIKI_PKG_NAME, 'wiki_watch_comments','n'),
	//array( WIKI_PKG_NAME, 'wiki_watch_editor','n'),
	//array( WIKI_PKG_NAME, 'wiki_words','y'),
	//array( WIKI_PKG_NAME, 'wikibook_hide_add_content','n'),
	//array( WIKI_PKG_NAME, 'wikibook_use_icons','n'),
) );

if( defined( 'RSS_PKG_NAME' )) {
	$gBitInstaller->registerPreferences( WIKI_PKG_NAME, array(
		array( RSS_PKG_NAME, WIKI_PKG_NAME.'_rss', 'y'),
	));
}

// ### Register content types
$gBitInstaller->registerContentObjects( WIKI_PKG_NAME, array(
	'BitPage' => WIKI_PKG_CLASS_PATH.'BitPage.php',
	'BitBook' => WIKI_PKG_CLASS_PATH.'BitBook.php',
));

// Requirements
$gBitInstaller->registerRequirements( WIKI_PKG_NAME, array(
    'liberty' => array( 'min' => '2.1.4' ),
));