20 |
package wiki::driver::http; |
package wiki::driver::http; |
21 |
use strict; |
use strict; |
22 |
|
|
|
## These lines should be removed after utf8 support |
|
|
BEGIN { |
|
|
$Message::Util::Formatter::Base::Token = qr/[\w._+\x80-\xFF-]+/; |
|
|
require Message::Util::Formatter::Base; |
|
|
} |
|
|
|
|
|
use Message::Util::Error; |
|
|
|
|
23 |
push our @Config, sub ($) { |
push our @Config, sub ($) { |
24 |
|
eval q{ use Message::Util::Error }; |
25 |
my $WIKI = shift; |
my $WIKI = shift; |
26 |
use Cwd qw(abs_path); |
use Cwd qw(abs_path); |
27 |
|
|
39 |
[db__lock__log_file => q"./wikidata/log/lock.log"], |
[db__lock__log_file => q"./wikidata/log/lock.log"], |
40 |
[db__log__dir => q"./wikidata/log/"], |
[db__log__dir => q"./wikidata/log/"], |
41 |
[db__temp__dir => q"./wikidata/lock/"], |
[db__temp__dir => q"./wikidata/lock/"], |
42 |
|
# [namazu__index_dir => q"/var/namazu/index/wiki"], |
43 |
) { |
) { |
44 |
## On system that does not set current directory as main script |
## On system that does not set current directory as main script |
45 |
## directory, you should specify it instead of using "abs_path". |
## directory, you should specify it instead of using "abs_path". |
46 |
$WIKI->{config}->{path_to}->{$_->[0]} = abs_path $_->[1]; |
$WIKI->{config}->{path_to}->{$_->[0]} = abs_path $_->[1]; |
47 |
} |
} |
48 |
|
|
49 |
|
=begin comment |
50 |
|
|
51 |
|
## -- Namazu URI Mapping (See SuikaWiki:SuikaWiki//Namazu) -- |
52 |
|
$WIKI->{config}->{nmz__uri_to_uri} = sub { |
53 |
|
my ($nmzuri, %opt) = @_; |
54 |
|
if ($nmzuri =~ s!^\Q$opt{o}->{wiki}->{config}->{path_to}->{db__content__dir}\E/*!!o) { |
55 |
|
$nmzuri =~ s/\.txt$//; |
56 |
|
return $opt{o}->{wiki}->uri_reference |
57 |
|
(page => $opt{o}->{wiki}->name ([ |
58 |
|
map {s/([0-9A-F][0-9A-F])/pack 'C', hex $1/ge; $_} |
59 |
|
split m!\.ns/!, $nmzuri |
60 |
|
]), base => 1); |
61 |
|
} else { |
62 |
|
return ($nmzuri, $nmzuri); |
63 |
|
} |
64 |
|
}; |
65 |
|
|
66 |
|
=end comment |
67 |
|
|
68 |
## -- WikiPlugin |
## -- WikiPlugin |
69 |
push @{$WIKI->{event}->{plugin_manager_loaded}}, sub { |
push @{$WIKI->{event}->{plugin_manager_loaded}}, sub { |
70 |
my $wiki = shift; |
my $wiki = shift; |
116 |
## Cache DBs |
## Cache DBs |
117 |
require SuikaWiki::DB::FileSystem::SuikaWikiCache09; |
require SuikaWiki::DB::FileSystem::SuikaWikiCache09; |
118 |
my $cachedb = SuikaWiki::DB::FileSystem::SuikaWikiCache09->new |
my $cachedb = SuikaWiki::DB::FileSystem::SuikaWikiCache09->new |
119 |
(directory => $wiki->{config}->{path_to}->{db__cache__dir}); |
(directory => $wiki->{config}->{path_to}->{db__cache__dir}, |
120 |
|
expires => 86400 * 3, removes => 86400 * 3); # 3 days |
121 |
$wiki->{db}->_set_prop_db (m__search_result => |
$wiki->{db}->_set_prop_db (m__search_result => |
122 |
{-db => $cachedb, -prop => 'search_result', -db_close => sub { |
{-db => $cachedb, -prop => 'search_result', -db_close => sub { |
123 |
my %opt = @_; |
my %opt = @_; |