33 |
|
|
34 |
push our @Config, sub ($) { |
push our @Config, sub ($) { |
35 |
my $WIKI = shift; |
my $WIKI = shift; |
36 |
use Cwd qw(abs_path); |
use FindBin q($Bin); |
37 |
|
use File::Spec; |
38 |
|
|
39 |
## -- Filesystem path mapping |
## -- Filesystem path mapping |
40 |
for ( |
for ( |
54 |
) { |
) { |
55 |
## On system that does not set current directory as main script |
## On system that does not set current directory as main script |
56 |
## directory, you should specify it instead of using "abs_path". |
## directory, you should specify it instead of using "abs_path". |
57 |
$WIKI->{config}->{path_to}->{$_->[0]} = abs_path $_->[1]; |
$WIKI->{config}->{path_to}->{$_->[0]} = File::Spec->rel2abs ($_->[1], $Bin); |
58 |
} |
} |
59 |
|
|
60 |
=begin comment |
=begin comment |
102 |
|
|
103 |
## Main content |
## Main content |
104 |
$wiki->{db}->_set_prop_db (content => {-db_open => sub { |
$wiki->{db}->_set_prop_db (content => {-db_open => sub { |
|
require SuikaWiki::DB::Logical; |
|
|
my $db = SuikaWiki::DB::Logical->new; |
|
|
$db->_set_prop_db (content => {-db_open => sub { |
|
|
require SuikaWiki::DB::FileSystem::LeafFile; |
|
|
SuikaWiki::DB::FileSystem::LeafFile->new |
|
|
(base_directory => $wiki->{config}->{path_to}->{db__content__dir}, |
|
|
directory_suffix => '.ns', |
|
|
file_suffix => '.txt', |
|
|
root_key => $wiki->{config}->{page}->{Default}, |
|
|
-lock => $wiki->{var}->{db}->{lock_prop} |
|
|
->('content', name => 'content')); |
|
|
}, -db_close => sub { |
|
|
my %opt = @_; |
|
|
$opt{prop_info}->{-db}->close; |
|
|
delete $opt{prop_info}->{-db}; |
|
|
}}); |
|
|
$db->_set_prop_db (content_seqed => {-db_open => sub { |
|
|
require SuikaWiki::DB::FileSystem::Seq; |
|
|
SuikaWiki::DB::FileSystem::Seq->new |
|
|
(base_directory => $wiki->{config}->{path_to}->{db__content__dir}, |
|
|
directory_suffix => 'nnn.ns', |
|
|
file_suffix => '.txt', |
|
|
-lock => $wiki->{var}->{db}->{lock_prop} |
|
|
->('content', name => 'content_seqed')); |
|
|
}, -db_close => sub { |
|
|
my %opt = @_; |
|
|
$opt{prop_info}->{-db}->close; |
|
|
delete $opt{prop_info}->{-db}; |
|
|
}}); |
|
|
$db; |
|
|
}, -prop => sub { |
|
|
my (undef, $prop, $key, %opt) = @_; |
|
|
($key and @$key == 1 and $key->[0] =~ /^[1-9][0-9]*$/) |
|
|
? 'content_seqed' : $opt{method} eq '_next_number' ? 'content_seqed' : 'content'; |
|
|
}, -db_close => sub { |
|
|
my %opt = @_; |
|
|
$opt{prop_info}->{-db}->close; |
|
|
delete $opt{prop_info}->{-db}; |
|
|
}}); |
|
|
|
|
|
$wiki->{db}->_set_prop_db (content_map => {-db_open => sub { |
|
105 |
require SuikaWiki::DB::FileSystem::LeafFile; |
require SuikaWiki::DB::FileSystem::LeafFile; |
106 |
SuikaWiki::DB::FileSystem::LeafFile->new |
SuikaWiki::DB::FileSystem::LeafFile->new |
107 |
(base_directory => $wiki->{config}->{path_to}->{db__content__dir}, |
(base_directory => $wiki->{config}->{path_to}->{db__content__dir}, |
108 |
directory_suffix => 'nnn.ns', |
directory_suffix => '.ns', |
109 |
file_suffix => '.map', |
file_suffix => '.txt', |
110 |
-lock => $wiki->{var}->{db}->{lock_prop} |
root_key => $wiki->{config}->{page}->{Default}, |
111 |
->('content', name => 'content_map')); |
-lock => $wiki->{var}->{db}->{lock_prop}->('content')); |
112 |
}, -db_close => sub { |
}, -db_close => sub { |
113 |
my %opt = @_; |
my %opt = @_; |
114 |
$opt{prop_info}->{-db}->close; |
$opt{prop_info}->{-db}->close; |
115 |
delete $opt{prop_info}->{-db}; |
delete $opt{prop_info}->{-db}; |
116 |
}}); |
}}); |
117 |
|
|
118 |
## Properties |
## Properties |
119 |
$wiki->{db}->_set_prop_db (content_prop => {-db_open => sub { |
$wiki->{db}->_set_prop_db (content_prop => {-db_open => sub { |
120 |
require SuikaWiki::DB::FileSystem::LeafProp; |
require SuikaWiki::DB::FileSystem::LeafProp; |
136 |
SuikaWiki::DB::FileSystem::SuikaWikiMetaInfo09->new |
SuikaWiki::DB::FileSystem::SuikaWikiMetaInfo09->new |
137 |
(directory => $wiki->{config}->{path_to}->{db__content__dir}, |
(directory => $wiki->{config}->{path_to}->{db__content__dir}, |
138 |
-lock => $wiki->{var}->{db}->{lock_prop}->('lastmodified')); |
-lock => $wiki->{var}->{db}->{lock_prop}->('lastmodified')); |
139 |
}, -prop => sub {'last_modified'}, -db_close => sub { |
}, -prop => 'last_modified', -db_close => sub { |
140 |
my %opt = @_; |
my %opt = @_; |
141 |
$opt{prop_info}->{-db}->close; |
$opt{prop_info}->{-db}->close; |
142 |
delete $opt{prop_info}->{-db}; |
delete $opt{prop_info}->{-db}; |
148 |
(directory => $wiki->{config}->{path_to}->{db__cache__dir}, |
(directory => $wiki->{config}->{path_to}->{db__cache__dir}, |
149 |
expires => 86400 * 3, removes => 86400 * 3); # 3 days |
expires => 86400 * 3, removes => 86400 * 3); # 3 days |
150 |
$wiki->{db}->_set_prop_db (m__search_result => |
$wiki->{db}->_set_prop_db (m__search_result => |
151 |
{-db => $cachedb, -db_close => sub { |
{-db => $cachedb, -prop => 'search_result', -db_close => sub { |
152 |
my %opt = @_; |
my %opt = @_; |
153 |
$opt{prop_info}->{-db}->close; |
$opt{prop_info}->{-db}->close; |
154 |
delete $opt{prop_info}->{-db}; |
delete $opt{prop_info}->{-db}; |
155 |
}}); |
}}); |
156 |
$wiki->{db}->_set_prop_db (wpp__headsummary => |
$wiki->{db}->_set_prop_db (wpp__headsummary => |
157 |
{-db => $cachedb, -db_close => sub { |
{-db => $cachedb, -prop => 'headsummary', -db_close => sub { |
158 |
my %opt = @_; |
my %opt = @_; |
159 |
$opt{prop_info}->{-db}->close; |
$opt{prop_info}->{-db}->close; |
160 |
delete $opt{prop_info}->{-db}; |
delete $opt{prop_info}->{-db}; |
161 |
}}); |
}}); |
162 |
$wiki->{db}->_set_prop_db (ref__item_template => |
$wiki->{db}->_set_prop_db (ref__item_template => |
163 |
{-db => $cachedb, -db_close => sub { |
{-db => $cachedb, -prop => 'refereritem', -db_close => sub { |
164 |
my %opt = @_; |
my %opt = @_; |
165 |
$opt{prop_info}->{-db}->close; |
$opt{prop_info}->{-db}->close; |
166 |
delete $opt{prop_info}->{-db}; |
delete $opt{prop_info}->{-db}; |
193 |
NewPageTemplate => $WIKI->name ([qw/Wiki NewPageTemplate/]), |
NewPageTemplate => $WIKI->name ([qw/Wiki NewPageTemplate/]), |
194 |
'StyleSheetList(text/html)' => $WIKI->name ([qw<Wiki Style List text/html>]), |
'StyleSheetList(text/html)' => $WIKI->name ([qw<Wiki Style List text/html>]), |
195 |
}; |
}; |
|
|
|
|
## -- Mode |
|
|
$WIKI->{config}->{mode}->{default} = 'para--read'; |
|
196 |
|
|
197 |
## -- WikiNamespace constants |
## -- WikiNamespace constants |
198 |
$WIKI->{config}->{name}->{space} = { |
$WIKI->{config}->{name}->{space} = { |