1 |
package main; |
=head1 NAME |
2 |
use strict; |
|
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 |
## [OBSOLETE] URI (or part of URI) of Wiki CGI itself and its external addons |
=cut |
|
## Note: If your Wiki CGI URI is <http://foo.example/path/to/wiki.cgi>, |
|
|
## cookie-path: /path/to/ |
|
|
## script-short-name: wiki.cgi |
|
|
## URI parts MUST NOT contains "&" and/or non-URI characters. |
|
|
our %uri = ( |
|
|
cookie_path => '/~wakaba/-temp/expwiki/', |
|
|
external_script => '../wiki/script/', |
|
|
script_short_name => 'wiki', |
|
|
## If you use CVS repository of WikiDatabase, |
|
|
#cvs_repository => 'http://path-to-viewcvs/path-to-repository/', |
|
|
); |
|
|
our $url_cgi = "http://".($main::ENV{HTTP_HOST} || $main::ENV{SERVER_NAME}.($main::ENV{SERVER_PORT}==80?'':":$main::ENV{SERVER_PORT}"))."$uri{cookie_path}$uri{script_short_name}"; |
|
|
$uri{wiki_abs} = $url_cgi; |
|
|
$uri{wiki} = qq($uri{cookie_path}$uri{script_short_name}); |
|
|
|
|
|
## Path to modules and databases |
|
|
push @main::INC, qw'lib ../wiki/lib lib'; |
|
|
|
|
|
## Constructing a new instance of the WikiEngine |
|
|
require SuikaWiki::Implementation; |
|
|
our $WIKI = SuikaWiki::Implementation->new; |
|
|
|
|
|
## Obsolete interface |
|
|
our %PathTo = ( ## Path to your data, from the main CGI script (NOT from this config script) |
|
|
CachePrefix => q(./wikidata/.cache.), # WikiPlugin |
|
|
TempPrefix => q(./wikidata/.tmp.), # WikiPlugin, Image |
|
|
convert => q(/usr/X11R6/bin/convert), # Image |
|
|
); |
|
19 |
|
|
20 |
## Filesystem path mapping |
package wiki::driver::http; |
21 |
|
use strict; |
22 |
|
|
23 |
|
sub config ($) { |
24 |
|
my $WIKI = shift; |
25 |
|
|
26 |
|
## -- Filesystem path mapping |
27 |
for ( |
for ( |
28 |
|
[db__cache__dir => q"./wikidata/lock/"], |
29 |
[db__content__dir => q"./wikidata/page"], |
[db__content__dir => q"./wikidata/page"], |
30 |
[db__content__error_log => q"./wikidata/log/db-content.log"], |
[db__content__error_log => q"./wikidata/log/db-content.log"], |
31 |
[db__lock__dir => q"./wikidata/lock/"], |
[db__lock__dir => q"./wikidata/lock/"], |
33 |
$WIKI->{config}->{path_to}->{$_->[0]} = $_->[1]; |
$WIKI->{config}->{path_to}->{$_->[0]} = $_->[1]; |
34 |
} |
} |
35 |
|
|
36 |
## WikiPlugin |
## -- WikiPlugin |
37 |
push @{$WIKI->{event}->{plugin_manager_loaded}}, sub { |
push @{$WIKI->{event}->{plugin_manager_loaded}}, sub { |
38 |
## Obsolete interface |
my $wiki = shift; |
|
push @SuikaWiki::Plugin::plugin_directory, ( |
|
|
# q(../wiki/lib/SuikaWiki/Plugin/), |
|
|
# q(../wiki/misc/plugins/), |
|
|
q(lib/SuikaWiki/Plugin/), |
|
|
q(misc/plugins/), |
|
|
); |
|
|
SuikaWiki::Plugin->import_plugins (); |
|
39 |
|
|
40 |
## Plugin style new configuration file |
## 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'; |
require 'wikidata/config.ph'; |
52 |
}; |
}; |
53 |
|
|
54 |
## WikiDatabase : Mapping of logical to physical |
## -- WikiDatabase: Mapping logical to physical |
55 |
push @{$WIKI->{event}->{database_loaded}}, sub { |
push @{$WIKI->{event}->{database_loaded}}, sub { |
56 |
|
my $wiki = shift; |
57 |
|
|
58 |
## Main content |
## Main content |
59 |
$WIKI->{db}->_set_prop_db (content => {-db_open => sub { |
$wiki->{db}->_set_prop_db (content => {-db_open => sub { |
60 |
require SuikaWiki::DB::FileSystem::YukiWikiDBNS; |
require SuikaWiki::DB::FileSystem::YukiWikiDBNS; |
61 |
SuikaWiki::DB::FileSystem::YukiWikiDBNS->new |
SuikaWiki::DB::FileSystem::YukiWikiDBNS->new |
62 |
(directory => $WIKI->{config}->{path_to}->{db__content__dir}, |
(directory => $wiki->{config}->{path_to}->{db__content__dir}, |
63 |
logfile => $WIKI->{config}->{path_to}->{db__content__error_log}, |
logfile => $wiki->{config}->{path_to}->{db__content__error_log}, |
64 |
suffix => '.txt', |
suffix => '.txt', |
65 |
-lock => &{$WIKI->{var}->{db}->{lock_prop}} ('content')); |
-lock => $wiki->{var}->{db}->{lock_prop}->('content')); |
66 |
}, -own => 1}); |
}, -db_close => sub { |
67 |
|
my %opt = @_; |
68 |
|
$opt{prop_info}->{-db}->close; |
69 |
|
delete $opt{prop_info}->{-db}; |
70 |
|
}}); |
71 |
|
|
72 |
## Last modified |
## Last modified |
73 |
$WIKI->{db}->_set_prop_db (lastmodified => {-db_open => sub { |
$wiki->{db}->_set_prop_db (lastmodified => {-db_open => sub { |
74 |
require SuikaWiki::DB::FileSystem::SuikaWikiMetaInfo09; |
require SuikaWiki::DB::FileSystem::SuikaWikiMetaInfo09; |
75 |
SuikaWiki::DB::FileSystem::SuikaWikiMetaInfo09->new |
SuikaWiki::DB::FileSystem::SuikaWikiMetaInfo09->new |
76 |
(directory => $WIKI->{config}->{path_to}->{db__content__dir}, |
(directory => $wiki->{config}->{path_to}->{db__content__dir}, |
77 |
-lock => &{$WIKI->{var}->{db}->{lock_prop}} ('lastmodified')); |
-lock => $wiki->{var}->{db}->{lock_prop}->('lastmodified')); |
78 |
}, -prop => 'last_modified', -own => 1}); |
}, -prop => 'last_modified', -db_close => sub { |
79 |
|
my %opt = @_; |
80 |
## OBSOLETE interface for transition |
$opt{prop_info}->{-db}->close; |
81 |
$WIKI->{db}->get (content => ['dummy']); |
delete $opt{prop_info}->{-db}; |
82 |
*main::database = $WIKI->{db}->{prop}->{content}->{-db}->{db_hash}; |
}}); |
83 |
$SuikaWiki::Plugin::DB = $WIKI->{db}; |
|
84 |
for (@{$SuikaWiki::Plugin::On{WikiDatabaseLoaded}||[]}) { &{$_} } |
## Cache |
85 |
|
require SuikaWiki::DB::FileSystem::SuikaWikiCache09; |
86 |
package wiki::dummy; |
my $cachedb = SuikaWiki::DB::FileSystem::SuikaWikiCache09->new |
87 |
sub meta {undef}; |
(directory => $wiki->{config}->{path_to}->{db__cache__dir}); |
88 |
sub list_items {}; |
$wiki->{db}->_set_prop_db (m__search_result => |
89 |
sub STORE {}; |
{-db => $cachedb, -prop => 'search_result', -db_close => sub { |
90 |
}; |
my %opt = @_; |
91 |
|
$opt{prop_info}->{-db}->close; |
92 |
## [OBSOLETE] Name of Special WikiPage (linked as parts of navigations) |
delete $opt{prop_info}->{-db}; |
93 |
our %PageName = ( |
}}); |
94 |
FrontPage => 'HomePage', |
$wiki->{db}->_set_prop_db (wpp__headsummary => |
95 |
IndexPage => 'IndexPage', |
{-db => $cachedb, -prop => 'headsummary', -db_close => sub { |
96 |
InterWikiName => 'Wiki//InterWikiName', |
my %opt = @_; |
97 |
SearchPage => 'Wiki//Page//Search', |
$opt{prop_info}->{-db}->close; |
98 |
CreatePage => 'Wiki//Page//Create', |
delete $opt{prop_info}->{-db}; |
99 |
MenuBar => 'Wiki//MenuBar', |
}}); |
100 |
RecentChanges => 'RecentChanges', |
|
101 |
RefererDontRecord => 'Wiki//Referer//IgnoreSite', |
## Additional WikiDB properties should be defined here |
102 |
RefererSiteName => 'Wiki//Referer//SiteName', |
# ... |
103 |
ResourceNS => 'Wiki//Resource//', |
}; |
104 |
StyleList => 'Wiki//Style//List//', |
|
105 |
UserAgentList => 'Wiki//UserAgentList', |
## -- WikiName of special purpose WikiPages |
|
AdminSpecialPage => "\x11\x11Admin\x11Special\x11Page\x11\x11", |
|
|
); |
|
|
|
|
|
## WikiName of special purpose WikiPages |
|
106 |
$WIKI->{config}->{page} = { |
$WIKI->{config}->{page} = { |
107 |
Default => [qw/HomePage/], |
Default => $WIKI->name ([qw/HomePage/]), |
108 |
NewPageTemplate => [qw/Wiki NewPageTemplate/], |
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 |
}; |
}; |
|
our %PageOf = %{$WIKI->{config}->{page}}; |
|
112 |
|
|
113 |
## WikiNamespace constants |
## -- WikiNamespace constants |
114 |
$WIKI->{config}->{name}->{space}->{separator} = '//'; |
$WIKI->{config}->{name}->{space} = { |
115 |
$WIKI->{config}->{name}->{space}->{separator_reg} = qr#//#; |
separator => '//', |
116 |
|
separator_reg => qr#\s*//\s*#, |
117 |
|
self => '.', |
118 |
|
parent => '..', |
119 |
|
}; |
120 |
|
|
121 |
## Character code |
## -- Default character codes |
122 |
$WIKI->{config}->{charset}->{internal} = 'euc-jp'; |
$WIKI->{config}->{charset} = { |
123 |
$WIKI->{config}->{charset}->{output} = 'iso-2022-jp'; |
## Internal code - MUST be ASCII + 8bit coding scheme |
124 |
$WIKI->{config}->{charset}->{uri_param} = ''; # auto detect |
internal => 'euc-jp', |
125 |
$WIKI->{config}->{charset}->{uri_query} = ''; # auto detect |
## 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 |
## -- Expires duration templates |
139 |
$WIKI->{config}->{entity}->{expires} = { |
$WIKI->{config}->{entity}->{expires} = { |
140 |
edit => {delta => 60}, |
edit => {delta => 60}, |
141 |
view => {delta => 2*3600}, |
view => {delta => 2*3600}, |
142 |
lm_flaged => {delta => 30*24*3600}, |
lm_flaged => {delta => 30*24*3600}, |
143 |
|
stylesheet => {delta => 30*24*3600}, |
144 |
|
error => {delta => 60}, |
145 |
}; |
}; |
146 |
|
|
147 |
=head1 NAME |
## -- 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 |
suikawiki-config.ph --- SuikaWiki: Configuration of the wiki |
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 |
=head1 LICENSE |
163 |
|
|
164 |
Copyright 2003 Wakaba <w@suika.fam.cx> |
Copyright 2003-2004 Wakaba <w@suika.fam.cx>. All rights reserved. |
165 |
|
|
166 |
This program is free software; you can redistribute it and/or |
This program is free software; you can redistribute it and/or |
167 |
modify it under the same terms as Perl itself. |
modify it under the same terms as Perl itself. |