/[pub]/suikawiki/wikidata/suikawiki-config.ph
Suika

Contents of /suikawiki/wikidata/suikawiki-config.ph

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12.4.2 - (show annotations) (download)
Sun Nov 9 02:49:12 2003 UTC (20 years, 6 months ago) by wakaba
Branch: branch-suikawiki-1
CVS Tags: before-fork-suikawiki3
Changes since 1.12.4.1: +21 -6 lines
*** empty log message ***

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24