1 |
=head1 NAME |
2 |
|
3 |
suikawiki-config.ph - SuikaWiki: Configuration for SuikaWiki HTTP CGI Driver |
4 |
|
5 |
=head1 DESCRIPTION |
6 |
|
7 |
This is a configuration file for SuikaWiki Driver for HTTP CGI Script |
8 |
(SWHCS). Basic options such as WikiDB directory mapping and |
9 |
special purpose WikiPage names can be customized with this file. |
10 |
|
11 |
More complex customizing, e.g. modifying navigation bar or |
12 |
adding new mode, is also possible by config.ph (generated from |
13 |
config.wp2) and WikiPlugin modules. For more information, |
14 |
see <http://suika.fam.cx/~wakaba/-temp/wiki/wiki?SuikaWiki>. |
15 |
|
16 |
This file is part of SuikaWiki. |
17 |
|
18 |
=cut |
19 |
|
20 |
package wiki::driver::http; |
21 |
use strict; |
22 |
|
23 |
sub config ($) { |
24 |
my $WIKI = shift; |
25 |
|
26 |
## -- Filesystem path mapping |
27 |
for ( |
28 |
[db__cache__dir => q"./wikidata/lock/"], |
29 |
[db__content__dir => q"./wikidata/page"], |
30 |
[db__content__error_log => q"./wikidata/log/db-content.log"], |
31 |
[db__lock__dir => q"./wikidata/lock/"], |
32 |
) { |
33 |
$WIKI->{config}->{path_to}->{$_->[0]} = $_->[1]; |
34 |
} |
35 |
|
36 |
## -- WikiPlugin |
37 |
push @{$WIKI->{event}->{plugin_manager_loaded}}, sub { |
38 |
my $wiki = shift; |
39 |
|
40 |
## Installed plugin modules |
41 |
$wiki->{plugin}->load_directory (qw( |
42 |
lib/SuikaWiki/Plugin/ |
43 |
misc/plugins/ |
44 |
misc/plugins/form/ |
45 |
misc/plugins/format/ |
46 |
misc/plugins/link/ |
47 |
misc/plugins/view/ |
48 |
)); |
49 |
|
50 |
## Configuration file as pseudo-plugin module |
51 |
require 'wikidata/config.ph'; |
52 |
}; |
53 |
|
54 |
## -- WikiDatabase: Mapping logical to physical |
55 |
push @{$WIKI->{event}->{database_loaded}}, sub { |
56 |
my $wiki = shift; |
57 |
|
58 |
## Main content |
59 |
$wiki->{db}->_set_prop_db (content => {-db_open => sub { |
60 |
require SuikaWiki::DB::FileSystem::YukiWikiDBNS; |
61 |
SuikaWiki::DB::FileSystem::YukiWikiDBNS->new |
62 |
(directory => $wiki->{config}->{path_to}->{db__content__dir}, |
63 |
logfile => $wiki->{config}->{path_to}->{db__content__error_log}, |
64 |
suffix => '.txt', |
65 |
-lock => $wiki->{var}->{db}->{lock_prop}->('content')); |
66 |
}, -db_close => sub { |
67 |
my %opt = @_; |
68 |
$opt{prop_info}->{-db}->close; |
69 |
delete $opt{prop_info}->{-db}; |
70 |
}}); |
71 |
|
72 |
## Last modified |
73 |
$wiki->{db}->_set_prop_db (lastmodified => {-db_open => sub { |
74 |
require SuikaWiki::DB::FileSystem::SuikaWikiMetaInfo09; |
75 |
SuikaWiki::DB::FileSystem::SuikaWikiMetaInfo09->new |
76 |
(directory => $wiki->{config}->{path_to}->{db__content__dir}, |
77 |
-lock => $wiki->{var}->{db}->{lock_prop}->('lastmodified')); |
78 |
}, -prop => 'last_modified', -db_close => sub { |
79 |
my %opt = @_; |
80 |
$opt{prop_info}->{-db}->close; |
81 |
delete $opt{prop_info}->{-db}; |
82 |
}}); |
83 |
|
84 |
## Cache |
85 |
require SuikaWiki::DB::FileSystem::SuikaWikiCache09; |
86 |
my $cachedb = SuikaWiki::DB::FileSystem::SuikaWikiCache09->new |
87 |
(directory => $wiki->{config}->{path_to}->{db__cache__dir}); |
88 |
$wiki->{db}->_set_prop_db (m__search_result => |
89 |
{-db => $cachedb, -prop => 'search_result', -db_close => sub { |
90 |
my %opt = @_; |
91 |
$opt{prop_info}->{-db}->close; |
92 |
delete $opt{prop_info}->{-db}; |
93 |
}}); |
94 |
$wiki->{db}->_set_prop_db (wpp__headsummary => |
95 |
{-db => $cachedb, -prop => 'headsummary', -db_close => sub { |
96 |
my %opt = @_; |
97 |
$opt{prop_info}->{-db}->close; |
98 |
delete $opt{prop_info}->{-db}; |
99 |
}}); |
100 |
|
101 |
## Additional WikiDB properties should be defined here |
102 |
# ... |
103 |
}; |
104 |
|
105 |
## -- WikiName of special purpose WikiPages |
106 |
$WIKI->{config}->{page} = { |
107 |
Default => $WIKI->name ([qw/HomePage/]), |
108 |
InterWikiName => $WIKI->name ([qw/Wiki InterWikiName/]), |
109 |
NewPageTemplate => $WIKI->name ([qw/Wiki NewPageTemplate/]), |
110 |
'StyleSheetList(text/html)' => $WIKI->name ([qw<Wiki Style List text/html>]), |
111 |
}; |
112 |
|
113 |
## -- WikiNamespace constants |
114 |
$WIKI->{config}->{name}->{space} = { |
115 |
separator => '//', |
116 |
separator_reg => qr#\s*//\s*#, |
117 |
self => '.', |
118 |
parent => '..', |
119 |
}; |
120 |
|
121 |
## -- Default character codes |
122 |
$WIKI->{config}->{charset} = { |
123 |
## Internal code - MUST be ASCII + 8bit coding scheme |
124 |
internal => 'euc-jp', |
125 |
## Default output code |
126 |
output => 'iso-2022-jp', |
127 |
## "query" part in URI reference |
128 |
uri_query => '', # auto-detected |
129 |
uri_query_encode => 'euc-jp', ## For compatibility w/ SuikaWiki 2 |
130 |
uri_param => '', # auto-detected |
131 |
uri_param_encode => 'euc-jp', ## For compatibility w/ SuikaWiki 2 |
132 |
## PATH_INFO part in URI reference |
133 |
uri_path_info => 'x-utf-8-10646', ## Reserved for future use |
134 |
## Fragment identifier in URI reference |
135 |
uri_fragment => 'x-punycode', ## Reserved for possible future use |
136 |
}; |
137 |
|
138 |
## -- Expires duration templates |
139 |
$WIKI->{config}->{entity}->{expires} = { |
140 |
edit => {delta => 60}, |
141 |
view => {delta => 2*3600}, |
142 |
lm_flaged => {delta => 30*24*3600}, |
143 |
stylesheet => {delta => 30*24*3600}, |
144 |
error => {delta => 60}, |
145 |
}; |
146 |
|
147 |
## -- Debug mode |
148 |
$WIKI->{config}->{debug} = { |
149 |
general => 1, |
150 |
db => 0, |
151 |
view => 1, |
152 |
}; |
153 |
|
154 |
} |
155 |
|
156 |
=head1 SEE ALSO |
157 |
|
158 |
C<lib/suikawiki.pl>, C<wiki.cgi>, |
159 |
<http://suika.fam.cx/~wakaba/-temp/wiki/wiki?SuikaWiki>, |
160 |
<http://suika.fam.cx/~wakaba/-temp/wiki/wiki?SWHCS> |
161 |
|
162 |
=head1 LICENSE |
163 |
|
164 |
Copyright 2003-2004 Wakaba <w@suika.fam.cx>. All rights reserved. |
165 |
|
166 |
This program is free software; you can redistribute it and/or |
167 |
modify it under the same terms as Perl itself. |
168 |
|
169 |
=cut |
170 |
|
171 |
1; # $Date: 2004/02/01 12:34:18 $ |