75 |
|
|
76 |
=end comment |
=end comment |
77 |
|
|
78 |
|
=cut |
79 |
|
|
80 |
## -- WikiPlugin |
## -- WikiPlugin |
81 |
push @{$WIKI->{event}->{plugin_manager_loaded}}, sub { |
push @{$WIKI->{event}->{plugin_manager_loaded}}, sub { |
82 |
my $wiki = shift; |
my $wiki = shift; |
101 |
|
|
102 |
## Main content |
## Main content |
103 |
$wiki->{db}->_set_prop_db (content => {-db_open => sub { |
$wiki->{db}->_set_prop_db (content => {-db_open => sub { |
104 |
|
require SuikaWiki::DB::Logical; |
105 |
|
my $db = SuikaWiki::DB::Logical->new; |
106 |
|
$db->_set_prop_db (content => {-db_open => sub { |
107 |
|
require SuikaWiki::DB::FileSystem::LeafFile; |
108 |
|
SuikaWiki::DB::FileSystem::LeafFile->new |
109 |
|
(base_directory => $wiki->{config}->{path_to}->{db__content__dir}, |
110 |
|
directory_suffix => '.ns', |
111 |
|
file_suffix => '.txt', |
112 |
|
root_key => $wiki->{config}->{page}->{Default}, |
113 |
|
-lock => $wiki->{var}->{db}->{lock_prop} |
114 |
|
->('content', name => 'content')); |
115 |
|
}, -db_close => sub { |
116 |
|
my %opt = @_; |
117 |
|
$opt{prop_info}->{-db}->close; |
118 |
|
delete $opt{prop_info}->{-db}; |
119 |
|
}}); |
120 |
|
$db->_set_prop_db (content_seqed => {-db_open => sub { |
121 |
|
require SuikaWiki::DB::FileSystem::Seq; |
122 |
|
SuikaWiki::DB::FileSystem::Seq->new |
123 |
|
(base_directory => $wiki->{config}->{path_to}->{db__content__dir}, |
124 |
|
directory_suffix => 'nnn.ns', |
125 |
|
file_suffix => '.txt', |
126 |
|
-lock => $wiki->{var}->{db}->{lock_prop} |
127 |
|
->('content', name => 'content_seqed')); |
128 |
|
}, -db_close => sub { |
129 |
|
my %opt = @_; |
130 |
|
$opt{prop_info}->{-db}->close; |
131 |
|
delete $opt{prop_info}->{-db}; |
132 |
|
}}); |
133 |
|
$db; |
134 |
|
}, -prop => sub { |
135 |
|
my (undef, $prop, $key, %opt) = @_; |
136 |
|
($key and @$key == 1 and $key->[0] =~ /^[1-9][0-9]*$/) |
137 |
|
? 'content_seqed' : $opt{method} eq '_next_number' ? 'content_seqed' : 'content'; |
138 |
|
}, -db_close => sub { |
139 |
|
my %opt = @_; |
140 |
|
$opt{prop_info}->{-db}->close; |
141 |
|
delete $opt{prop_info}->{-db}; |
142 |
|
}}); |
143 |
|
|
144 |
|
$wiki->{db}->_set_prop_db (content_map => {-db_open => sub { |
145 |
require SuikaWiki::DB::FileSystem::LeafFile; |
require SuikaWiki::DB::FileSystem::LeafFile; |
146 |
SuikaWiki::DB::FileSystem::LeafFile->new |
SuikaWiki::DB::FileSystem::LeafFile->new |
147 |
(base_directory => $wiki->{config}->{path_to}->{db__content__dir}, |
(base_directory => $wiki->{config}->{path_to}->{db__content__dir}, |
148 |
directory_suffix => '.ns', |
directory_suffix => 'nnn.ns', |
149 |
file_suffix => '.txt', |
file_suffix => '.map', |
150 |
root_key => $wiki->{config}->{page}->{Default}, |
-lock => $wiki->{var}->{db}->{lock_prop} |
151 |
-lock => $wiki->{var}->{db}->{lock_prop}->('content_prop')); |
->('content', name => 'content_map')); |
152 |
}, -db_close => sub { |
}, -db_close => sub { |
153 |
my %opt = @_; |
my %opt = @_; |
154 |
$opt{prop_info}->{-db}->close; |
$opt{prop_info}->{-db}->close; |
155 |
delete $opt{prop_info}->{-db}; |
delete $opt{prop_info}->{-db}; |
156 |
}}); |
}}); |
157 |
|
|
158 |
## Properties |
## Properties |
159 |
$wiki->{db}->_set_prop_db (content_prop => {-db_open => sub { |
$wiki->{db}->_set_prop_db (content_prop => {-db_open => sub { |
160 |
require SuikaWiki::DB::FileSystem::LeafProp; |
require SuikaWiki::DB::FileSystem::LeafProp; |
163 |
directory_suffix => '.ns', |
directory_suffix => '.ns', |
164 |
file_suffix => '.prop', |
file_suffix => '.prop', |
165 |
root_key => $wiki->{config}->{page}->{Default}, |
root_key => $wiki->{config}->{page}->{Default}, |
166 |
-lock => $wiki->{var}->{db}->{lock_prop}->('content')); |
-lock => $wiki->{var}->{db}->{lock_prop}->('content_prop')); |
167 |
}, -db_close => sub { |
}, -db_close => sub { |
168 |
my %opt = @_; |
my %opt = @_; |
169 |
$opt{prop_info}->{-db}->close; |
$opt{prop_info}->{-db}->close; |
176 |
SuikaWiki::DB::FileSystem::SuikaWikiMetaInfo09->new |
SuikaWiki::DB::FileSystem::SuikaWikiMetaInfo09->new |
177 |
(directory => $wiki->{config}->{path_to}->{db__content__dir}, |
(directory => $wiki->{config}->{path_to}->{db__content__dir}, |
178 |
-lock => $wiki->{var}->{db}->{lock_prop}->('lastmodified')); |
-lock => $wiki->{var}->{db}->{lock_prop}->('lastmodified')); |
179 |
}, -prop => 'last_modified', -db_close => sub { |
}, -prop => sub {'last_modified'}, -db_close => sub { |
180 |
my %opt = @_; |
my %opt = @_; |
181 |
$opt{prop_info}->{-db}->close; |
$opt{prop_info}->{-db}->close; |
182 |
delete $opt{prop_info}->{-db}; |
delete $opt{prop_info}->{-db}; |
188 |
(directory => $wiki->{config}->{path_to}->{db__cache__dir}, |
(directory => $wiki->{config}->{path_to}->{db__cache__dir}, |
189 |
expires => 86400 * 3, removes => 86400 * 3); # 3 days |
expires => 86400 * 3, removes => 86400 * 3); # 3 days |
190 |
$wiki->{db}->_set_prop_db (m__search_result => |
$wiki->{db}->_set_prop_db (m__search_result => |
191 |
{-db => $cachedb, -prop => 'search_result', -db_close => sub { |
{-db => $cachedb, -db_close => sub { |
192 |
my %opt = @_; |
my %opt = @_; |
193 |
$opt{prop_info}->{-db}->close; |
$opt{prop_info}->{-db}->close; |
194 |
delete $opt{prop_info}->{-db}; |
delete $opt{prop_info}->{-db}; |
195 |
}}); |
}}); |
196 |
$wiki->{db}->_set_prop_db (wpp__headsummary => |
$wiki->{db}->_set_prop_db (wpp__headsummary => |
197 |
{-db => $cachedb, -prop => 'headsummary', -db_close => sub { |
{-db => $cachedb, -db_close => sub { |
198 |
my %opt = @_; |
my %opt = @_; |
199 |
$opt{prop_info}->{-db}->close; |
$opt{prop_info}->{-db}->close; |
200 |
delete $opt{prop_info}->{-db}; |
delete $opt{prop_info}->{-db}; |
201 |
}}); |
}}); |
202 |
$wiki->{db}->_set_prop_db (ref__item_template => |
$wiki->{db}->_set_prop_db (ref__item_template => |
203 |
{-db => $cachedb, -prop => 'refereritem', -db_close => sub { |
{-db => $cachedb, -db_close => sub { |
204 |
my %opt = @_; |
my %opt = @_; |
205 |
$opt{prop_info}->{-db}->close; |
$opt{prop_info}->{-db}->close; |
206 |
delete $opt{prop_info}->{-db}; |
delete $opt{prop_info}->{-db}; |
226 |
# ... |
# ... |
227 |
}; |
}; |
228 |
|
|
|
push @{$WIKI->{event}->{input_close}}, sub { |
|
|
my ($wiki, $event) = @_; |
|
|
try { |
|
|
SuikaWiki::Plugin->module_package ('Referer') |
|
|
->add_referer (wiki => $wiki, |
|
|
uri => $wiki->{input}->meta_variable |
|
|
('HTTP_REFERER')); |
|
|
} catch SuikaWiki::Plugin::error with { |
|
|
my $err = shift; |
|
|
$err->raise unless $err->{-type} eq 'PLUGIN_NOT_FOUND'; |
|
|
}; |
|
|
try { |
|
|
SuikaWiki::Plugin->module_package ('RequestLog') |
|
|
->http_request_log (wiki => $wiki, |
|
|
prop => 'log__http_request'); |
|
|
} catch SuikaWiki::Plugin::error with { |
|
|
my $err = shift; |
|
|
$err->raise unless $err->{-type} eq 'PLUGIN_NOT_FOUND'; |
|
|
}; |
|
|
}; |
|
|
|
|
229 |
## -- WikiName of special purpose WikiPages |
## -- WikiName of special purpose WikiPages |
230 |
$WIKI->{config}->{page} = { |
$WIKI->{config}->{page} = { |
231 |
Default => $WIKI->name ([qw/HomePage/]), |
Default => $WIKI->name ([qw/HomePage/]), |
233 |
NewPageTemplate => $WIKI->name ([qw/Wiki NewPageTemplate/]), |
NewPageTemplate => $WIKI->name ([qw/Wiki NewPageTemplate/]), |
234 |
'StyleSheetList(text/html)' => $WIKI->name ([qw<Wiki Style List text/html>]), |
'StyleSheetList(text/html)' => $WIKI->name ([qw<Wiki Style List text/html>]), |
235 |
}; |
}; |
236 |
|
|
237 |
|
## -- Mode |
238 |
|
$WIKI->{config}->{mode}->{default} = 'para--read'; |
239 |
|
|
240 |
## -- WikiNamespace constants |
## -- WikiNamespace constants |
241 |
$WIKI->{config}->{name}->{space} = { |
$WIKI->{config}->{name}->{space} = { |