28 |
use Message::Util::Error; |
use Message::Util::Error; |
29 |
|
|
30 |
use Message::Util::QName::General [q<ExpandedURI>], { |
use Message::Util::QName::General [q<ExpandedURI>], { |
31 |
|
'log' => q<http://suika.fam.cx/~wakaba/-temp/2004/05/01/reqlog#>, |
32 |
'media-type' => q<http://suika.fam.cx/~wakaba/-temp/2004/04/24/mt#>, |
'media-type' => q<http://suika.fam.cx/~wakaba/-temp/2004/04/24/mt#>, |
33 |
}; |
}; |
34 |
|
|
61 |
|
|
62 |
push our @Config, sub ($) { |
push our @Config, sub ($) { |
63 |
my $WIKI = shift; |
my $WIKI = shift; |
64 |
use Cwd qw(abs_path); |
use FindBin q($Bin); |
65 |
|
use File::Spec; |
66 |
|
|
67 |
## -- Filesystem path mapping |
## -- Filesystem path mapping |
68 |
for ( |
for ( |
77 |
[db__lock__dir => q"./wikidata/lock/"], |
[db__lock__dir => q"./wikidata/lock/"], |
78 |
[db__lock__log_file => q"./wikidata/log/lock.log"], |
[db__lock__log_file => q"./wikidata/log/lock.log"], |
79 |
[db__log__dir => q"./wikidata/log/"], |
[db__log__dir => q"./wikidata/log/"], |
80 |
|
[db__request_log__dir => q"./wikidata/rlog/"], |
81 |
[db__temp__dir => q"./wikidata/lock/"], |
[db__temp__dir => q"./wikidata/lock/"], |
82 |
[namazu__index_dir => q"/var/namazu/index/suikawiki"], |
[namazu__index_dir => q"/var/namazu/index/suikawiki"], |
83 |
) { |
) { |
84 |
## On system that does not set current directory as main script |
## On system that does not set current directory as main script |
85 |
## directory, you should specify it instead of using "abs_path". |
## directory, you should specify it instead of using "abs_path". |
86 |
$WIKI->{config}->{path_to}->{$_->[0]} = abs_path $_->[1]; |
$WIKI->{config}->{path_to}->{$_->[0]} = File::Spec->catfile ($Bin, $_->[1]); |
87 |
} |
} |
88 |
|
|
89 |
## -- Namazu URI Mapping (See SuikaWiki:SuikaWiki//Namazu) -- |
## -- Namazu URI Mapping (See SuikaWiki:SuikaWiki//Namazu) -- |
235 |
|
|
236 |
## HTTP Request Logging Database (See RequestLog plugin module) |
## HTTP Request Logging Database (See RequestLog plugin module) |
237 |
$wiki->{db}->_set_prop_db (log__http_request => {-db_open => sub { |
$wiki->{db}->_set_prop_db (log__http_request => {-db_open => sub { |
238 |
require SuikaWiki::DB::Hash; |
require SuikaWiki::DB::FileSystem::Count; |
239 |
new SuikaWiki::DB::Hash constructor => sub { |
SuikaWiki::DB::FileSystem::Count->new |
240 |
tie my %db, 'BerkeleyDB::Hash', |
(base_directory => $wiki->{config}->{path_to}->{db__request_log__dir}, |
241 |
-Filename => 'http-request-log.db', |
directory_suffix => '.ns', |
242 |
-Env => $bdbenv, |
file_suffix => '.rlog', |
243 |
-Flags => DB_CREATE, |
root_key => $wiki->{config}->{page}->{Default}, |
244 |
-Mode => 0644; |
auto_mkdir => 1); |
245 |
\%db; |
}, -db_close => sub { |
246 |
}; |
my %opt = @_; |
247 |
|
$opt{prop_info}->{-db}->close; |
248 |
|
delete $opt{prop_info}->{-db}; |
249 |
}}); |
}}); |
250 |
|
|
251 |
## Additional WikiDB properties should be defined here |
## Additional WikiDB properties should be defined here |
255 |
push @{$WIKI->{event}->{input_close}}, sub { |
push @{$WIKI->{event}->{input_close}}, sub { |
256 |
my ($wiki, $event) = @_; |
my ($wiki, $event) = @_; |
257 |
try { |
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 { |
|
258 |
SuikaWiki::Plugin->module_package ('RequestLog') |
SuikaWiki::Plugin->module_package ('RequestLog') |
259 |
->http_request_log (wiki => $wiki, |
->http_request_log (wiki => $wiki, |
260 |
prop => 'log__http_request'); |
prop => 'log__http_request'); |
270 |
InterWikiName => $WIKI->name ([qw/Wiki InterWikiName/]), |
InterWikiName => $WIKI->name ([qw/Wiki InterWikiName/]), |
271 |
NewPageTemplate => $WIKI->name ([qw/Wiki NewPageTemplate/]), |
NewPageTemplate => $WIKI->name ([qw/Wiki NewPageTemplate/]), |
272 |
'StyleSheetList(text/html)' => $WIKI->name ([qw<Wiki Style List text/html>]), |
'StyleSheetList(text/html)' => $WIKI->name ([qw<Wiki Style List text/html>]), |
273 |
|
ExpandedURI q<log:root> => $WIKI->name ([]), |
274 |
}; |
}; |
275 |
|
|
276 |
## -- WikiNamespace constants |
## -- WikiNamespace constants |