1 |
w |
1.1 |
use strict; |
2 |
wakaba |
1.6 |
|
3 |
|
|
## URI (or part of URI) of Wiki CGI itself and its external addons |
4 |
|
|
## Note: If your Wiki CGI URI is <http://foo.example/path/to/wiki.cgi>, |
5 |
|
|
## cookie-path: /path/to/ |
6 |
|
|
## script-short-name: wiki.cgi |
7 |
|
|
## URI parts MUST NOT contains "&" and/or non-URI characters. |
8 |
|
|
our %uri = ( |
9 |
w |
1.9 |
cookie_path => '/~wakaba/-temp/wiki/', |
10 |
wakaba |
1.6 |
external_script => '../wiki/script/', |
11 |
|
|
script_short_name => 'wiki', |
12 |
wakaba |
1.7 |
## If you use CVS repository of WikiDatabase, |
13 |
wakaba |
1.11 |
cvs_repository => '/gate/cvs/suikawiki/wikidata/page/', |
14 |
wakaba |
1.6 |
); |
15 |
|
|
our $url_cgi; { |
16 |
w |
1.4 |
my $scheme = 'http'; |
17 |
|
|
$scheme = lc $1 if $main::ENV{SERVER_PROTOCOL} =~ m#([A-Za-z0-9+.%-]+)#; |
18 |
wakaba |
1.11 |
$url_cgi = "$scheme://".($main::ENV{HTTP_HOST} || $main::ENV{SERVER_NAME}.($main::ENV{SERVER_PORT}==80?'':":$main::ENV{SERVER_PORT}"))."$uri{cookie_path}$uri{script_short_name}"; |
19 |
wakaba |
1.6 |
} |
20 |
wakaba |
1.10 |
$uri{wiki_abs} = $url_cgi; |
21 |
|
|
$uri{wiki} = qq($uri{cookie_path}$uri{script_short_name}); |
22 |
wakaba |
1.6 |
|
23 |
|
|
## Path to modules and databases |
24 |
wakaba |
1.10 |
push @main::INC, 'lib'; |
25 |
w |
1.9 |
push @SuikaWiki::Plugin::plugin_directory, ( |
26 |
wakaba |
1.10 |
q(lib/SuikaWiki/Plugin/), |
27 |
|
|
q(misc/plugins/), |
28 |
w |
1.9 |
); |
29 |
wakaba |
1.6 |
our %PathTo = ( ## Path to your data, from the main CGI script (NOT from this config script) |
30 |
wakaba |
1.11 |
CachePrefix => q(./wikidata/.cache.), |
31 |
|
|
TempPrefix => q(./wikidata/.tmp.), |
32 |
|
|
WikiDataBase => q(./wikidata/page), |
33 |
|
|
WikiDatabase => q(./wikidata/page), |
34 |
|
|
WikiDatabaseErrorLog => q(./wikidata/log/error.log), |
35 |
|
|
convert => q(/usr/X11R6/bin/convert), |
36 |
wakaba |
1.6 |
); |
37 |
|
|
|
38 |
wakaba |
1.11 |
require SuikaWiki::DB::Util::Lock; |
39 |
|
|
our $locker = SuikaWiki::DB::Util::Lock->new (-directory => q(./wikidata/lock), |
40 |
|
|
-name => 'wikipage', |
41 |
wakaba |
1.12 |
-retry => ($main::ENV{HTTP_USER_AGENT} =~ m#Openbot/3# ? 2 : 80), |
42 |
|
|
-timeout => 300, |
43 |
wakaba |
1.11 |
-error_handler => sub { |
44 |
|
|
my ($self, %o) = @_; |
45 |
|
|
open LOG, '>>', $main::PathTo{WikiDatabaseErrorLog}; |
46 |
|
|
print LOG scalar (gmtime)."\@@{[time]} @{[$$]} {$o{level}}: ", $o{msg}, "\n"; |
47 |
|
|
close LOG; |
48 |
|
|
if ($o{level} eq 'fatal') { |
49 |
|
|
die $o{msg}; |
50 |
|
|
} |
51 |
|
|
}); |
52 |
|
|
$locker->lock or do { |
53 |
|
|
open LOG, '>>', $main::PathTo{WikiDatabaseErrorLog}; |
54 |
|
|
print LOG scalar (time), " Can't lock\n"; |
55 |
|
|
close LOG; |
56 |
|
|
die "Can't lock"; |
57 |
|
|
}; |
58 |
|
|
|
59 |
|
|
|
60 |
|
|
|
61 |
wakaba |
1.6 |
## Type of WikiPage Database |
62 |
|
|
#our $modifier_dbtype = 'AnyDBM_File'; # Fast, not available on some server, page size limited. |
63 |
|
|
#our $modifier_dbtype = 'dbmopen'; # Fast, not available on some server, page size limited. |
64 |
|
|
#our $modifier_dbtype = 'Yuki::YukiWikiDB'; # Slow, available on all environment. |
65 |
|
|
#our $modifier_dbtype = 'Yuki::YukiWikiDB2'; # Slow, available on all environment. |
66 |
|
|
our $modifier_dbtype = 'Yuki::YukiWikiDBMeta'; # Slow, available on all environment. |
67 |
|
|
our $use_exists = 1; # If you can use 'exists' method for your DB. |
68 |
|
|
|
69 |
|
|
## Name of Special WikiPage (linked as parts of navigations) |
70 |
|
|
our %PageName = ( |
71 |
|
|
FrontPage => 'HomePage', |
72 |
|
|
IndexPage => 'IndexPage', |
73 |
w |
1.9 |
InterWikiName => 'Wiki//InterWikiName', |
74 |
|
|
SearchPage => 'Wiki//Page//Search', |
75 |
|
|
CreatePage => 'Wiki//Page//Create', |
76 |
|
|
MenuBar => 'Wiki//MenuBar', |
77 |
wakaba |
1.6 |
RecentChanges => 'RecentChanges', |
78 |
w |
1.9 |
RefererDontRecord => 'Wiki//Referer//IgnoreSite', |
79 |
|
|
RefererSiteName => 'Wiki//Referer//SiteName', |
80 |
wakaba |
1.7 |
ResourceNS => 'Wiki//Resource//', |
81 |
wakaba |
1.8 |
StyleList => 'Wiki//Style//List//', |
82 |
|
|
UserAgentList => 'Wiki//UserAgentList', |
83 |
wakaba |
1.6 |
AdminSpecialPage => "\x11\x11Admin\x11Special\x11Page\x11\x11", |
84 |
|
|
); |
85 |
|
|
|
86 |
|
|
## (Should be reimplemented) |
87 |
|
|
our $kanjicode = 'euc'; |
88 |
|
|
our $lang = 'ja'; |
89 |
|
|
|
90 |
|
|
## Misc. options |
91 |
w |
1.9 |
$SuikaWiki::Plugin::UserAgent::LoggingName = 1; |
92 |
|
|
## Use UA-name log? (require UserAgent plugin module) |
93 |
w |
1.3 |
|
94 |
wakaba |
1.6 |
## Definition of views |
95 |
w |
1.4 |
|
96 |
wakaba |
1.7 |
require SuikaWiki::View; |
97 |
wakaba |
1.8 |
SuikaWiki::View->template ('links')->add_line (<<'EOH'); |
98 |
w |
1.9 |
%link-wiki(page=>"Wiki//News",rel=>News,class=>wiki,title=>"%res(name=>GoToWikiNewsLink);"p); |
99 |
|
|
%link-wiki(page=>"Wiki//Help",rel=>help,class=>wiki,title=>"%res(name=>GoToWikiHelpLink);"p); |
100 |
|
|
%link-wiki(page=>"Wiki//Page//License",rel=>copyright,class=>wiki,title=>"%res(name=>GoToWikiPageLicenseLink);"p); |
101 |
wakaba |
1.8 |
EOH |
102 |
wakaba |
1.12 |
|
103 |
w |
1.9 |
SuikaWiki::View->template ('navbar')->add_line (<<"EOH"); |
104 |
wakaba |
1.11 |
%anchor-wiki(mode=>edit,rel=>edit,class=>wiki-cmd,label=>"%res(name=>EditThisPage);"p,title=>"%res(name=>EditThisPageLong);"p,accesskey=>E,add-param=>{#edit}); |
105 |
w |
1.9 |
%anchor-wiki(rel=>view,up_to_date,class=>wiki-cmd,label=>"%res(name=>ViewThisPage);"p,title=>"%res(name=>ViewThisPageLong);"p); |
106 |
|
|
%anchor-wiki(page=>{$main::PageName{CreatePage}},class=>wiki,label=>"%res(name=>GoToCreatePage);"p,title=>"%res(name=>GoToCreatePageLong);"p); |
107 |
|
|
%anchor-wiki(page=>{$main::PageName{SearchPage}},class=>wiki,label=>"%res(name=>GoToSearchPage);"p,title=>"%res(name=>GoToSearchPageLong);"p); |
108 |
|
|
%anchor-wiki(mode=>RandomJump,up-to-date,rel=>lucky,class=>"wiki randomlink",label=>"%res(name=>GoSomewhere);"p,title=>"%res(name=>GoSomewhereLong);"p); |
109 |
|
|
%anchor-wiki(page=>{$main::PageName{RecentChanges}},class=>wiki,label=>"%res(name=>GoToRecentChanges);"p,title=>"%res(name=>GoToRecentChangesLong,safe);"p); |
110 |
w |
1.4 |
EOH |
111 |
|
|
|
112 |
wakaba |
1.8 |
push @{$SuikaWiki::Plugin::On{Load}}, sub { |
113 |
|
|
SuikaWiki::View->definition ('read')->property (template => <<'EOH'); |
114 |
|
|
%html-document(title=>{%res(name=>{View:WebPageTitle});}p,link-meta=>{%predefined-template(name=>links);}p,content=>{ |
115 |
|
|
%section(level=>1,add-to-toc=>0,type=>body,title=>{%ns-short-page-name;}p,heading,content=>{ |
116 |
|
|
%section(id=>tools1,class=>tools,add-to-toc=>0,content=>{%predefined-template(name=>navbar);}p); |
117 |
|
|
%section(level=>2,id=>read,add-to-toc=>0,content=>{ |
118 |
|
|
%if-calender(month,true=>{ |
119 |
|
|
%format(context=>form_input,template=>{%calender;}); |
120 |
|
|
},false=>{ |
121 |
|
|
%if-calender(true=>{ |
122 |
|
|
%format(context=>form_input,template=>{%calender-months;}); |
123 |
|
|
}); |
124 |
|
|
}); |
125 |
|
|
%read(comment); |
126 |
|
|
}p); |
127 |
|
|
%section(level=>2,id=>children,title=>{%res(name=>{Children:Title});}p,heading, |
128 |
w |
1.9 |
content=>{%page-list(ns=>{%page-name;}p,recursive=>0,type=>both,template=>{%res(name=>{Children:Item});}p);}p); |
129 |
wakaba |
1.8 |
%section(level=>2,id=>see-also,title=>{%res(name=>SeeAlso);}p,heading,content=>{%search-result;}p); |
130 |
|
|
%section(level=>2,id=>referer,title=>{%res(name=>Referer);}p,heading,content=>{%referer-list;}p); |
131 |
w |
1.9 |
%section(level=>2,id=>toc,title=>{%res(name=>{TOC:Title});}p,heading,add_to_toc=>0,content=>{%toc(drag);}p); |
132 |
wakaba |
1.8 |
%section(id=>last-modified,add_to_toc=>0,content=>{%res(name=>{LastModified=});%last-modified;}p); |
133 |
|
|
%section(class=>tools,add_to_toc=>0,content=>{%predefined-template(name=>navbar);}p); |
134 |
|
|
%section(id=>footer,add-to-toc=>0,content=>{%predefined-template(name=>footer);}p); |
135 |
|
|
}p); |
136 |
|
|
}p);%log-hotness; |
137 |
w |
1.4 |
EOH |
138 |
wakaba |
1.8 |
SuikaWiki::View->definition ('-wrote')->property (template => SuikaWiki::View->definition ('-wrote')->property ('template').q(%log-hotness(weight=>2);)); |
139 |
w |
1.9 |
SuikaWiki::View->definition ('WithMenu')->property (template => SuikaWiki::View->definition ('WithMenu')->property ('template').q(%log-hotness;)); |
140 |
wakaba |
1.8 |
}; |
141 |
w |
1.1 |
|
142 |
wakaba |
1.6 |
=head1 NAME |
143 |
|
|
|
144 |
|
|
suikawiki-config.ph --- SuikaWiki: site configuration script |
145 |
|
|
|
146 |
|
|
=head1 LICENSE |
147 |
|
|
|
148 |
|
|
Copyright 2003 Wakaba <w@suika.fam.cx> |
149 |
|
|
|
150 |
|
|
This program is free software; you can redistribute it and/or |
151 |
|
|
modify it under the same terms as Perl itself. |
152 |
|
|
|
153 |
|
|
=cut |
154 |
|
|
|
155 |
wakaba |
1.12 |
1; # $Date: 2003/09/16 05:14:52 $ |