/[pub]/suikawiki/script/default/suikawiki-config.ph
Suika

Contents of /suikawiki/script/default/suikawiki-config.ph

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (show annotations) (download)
Sat Oct 25 06:40:08 2003 UTC (21 years, 6 months ago) by wakaba
Branch: MAIN
Changes since 1.5: +131 -274 lines
Imported to CVS

1 package main;
2 use strict;
3
4
5 ## URI (or part of URI) of Wiki CGI itself and its external addons
6 ## Note: If your Wiki CGI URI is <http://foo.example/path/to/wiki.cgi>,
7 ## cookie-path: /path/to/
8 ## script-short-name: wiki.cgi
9 ## URI parts MUST NOT contains "&" and/or non-URI characters.
10 our %uri = (
11 cookie_path => '/~wakaba/-temp/expwiki/',
12 external_script => '../wiki/script/',
13 script_short_name => 'wiki',
14 ## If you use CVS repository of WikiDatabase,
15 #cvs_repository => 'http://path-to-viewcvs/path-to-repository/',
16 );
17 our $url_cgi = "http://".($main::ENV{HTTP_HOST} || $main::ENV{SERVER_NAME}.($main::ENV{SERVER_PORT}==80?'':":$main::ENV{SERVER_PORT}"))."$uri{cookie_path}$uri{script_short_name}";
18 $uri{wiki_abs} = $url_cgi;
19 $uri{wiki} = qq($uri{cookie_path}$uri{script_short_name});
20
21 ## Path to modules and databases
22 push @main::INC, qw'lib ../wiki/lib lib';
23
24 require SuikaWiki::Implementation;
25 our $WIKI = SuikaWiki::Implementation->new;
26
27 our %PathTo = ( ## Path to your data, from the main CGI script (NOT from this config script)
28 CachePrefix => q(./wikidata/.cache.), # WikiPlugin
29 TempPrefix => q(./wikidata/.tmp.), # WikiPlugin, Image
30 convert => q(/usr/X11R6/bin/convert), # Image
31 );
32
33 ## Filesystem path mapping
34 for (
35 [db__content__dir => q"./wikidata/page"],
36 [db__content__error_log => q"./wikidata/log/db-content.log"],
37 [db__lock__dir => q"./wikidata/lock/"],
38 ) {
39 $WIKI->{config}->{path_to}->{$_->[0]} = $_->[1];
40 }
41
42 ## Plugin
43 push @{$WIKI->{event}->{plugin_manager_loaded}}, sub {
44 ## Obsolete interface
45 push @SuikaWiki::Plugin::plugin_directory, (
46 q(../wiki/lib/SuikaWiki/Plugin/),
47 q(../wiki/misc/plugins/),
48 q(lib/SuikaWiki/Plugin/),
49 q(misc/plugins/),
50 );
51 SuikaWiki::Plugin->import_plugins ();
52 require 'wikidata/config.ph';
53 };
54
55 ## Database mapping
56 push @{$WIKI->{event}->{database_loaded}}, sub {
57 ## Main content
58 $WIKI->{db}->_set_prop_db (content => {-db_open => sub {
59 require SuikaWiki::DB::FileSystem::YukiWikiDBNS;
60 SuikaWiki::DB::FileSystem::YukiWikiDBNS->new
61 (directory => $WIKI->{config}->{path_to}->{db__content__dir},
62 logfile => $WIKI->{config}->{path_to}->{db__content__error_log},
63 suffix => '.txt',
64 -lock => &{$WIKI->{var}->{db}->{lock_prop}} ('content'));
65 }, -own => 1});
66
67 ## Last modified
68 $WIKI->{db}->_set_prop_db (lastmodified => {-db_open => sub {
69 require SuikaWiki::DB::FileSystem::SuikaWikiMetaInfo09;
70 SuikaWiki::DB::FileSystem::SuikaWikiMetaInfo09->new
71 (directory => $WIKI->{config}->{path_to}->{db__content__dir},
72 -lock => &{$WIKI->{var}->{db}->{lock_prop}} ('lastmodified'));
73 }, -prop => 'last_modified', -own => 1});
74 };
75
76 push @{$WIKI->{event}->{database_loaded}}, sub {
77 $WIKI->{db}->get (content => ['dummy']);
78 *main::database = $WIKI->{db}->{prop}->{content}->{-db}->{db_hash};
79 $SuikaWiki::Plugin::DB = $WIKI->{db};
80 for (@{$SuikaWiki::Plugin::On{WikiDatabaseLoaded}||[]}) { &{$_} }
81
82 package wiki::dummy;
83 sub meta {undef};
84 sub list_items {};
85 sub STORE {};
86 };
87
88
89 ## Name of Special WikiPage (linked as parts of navigations)
90 our %PageName = (
91 FrontPage => 'HomePage',
92 IndexPage => 'IndexPage',
93 InterWikiName => 'Wiki//InterWikiName',
94 SearchPage => 'Wiki//Page//Search',
95 CreatePage => 'Wiki//Page//Create',
96 MenuBar => 'Wiki//MenuBar',
97 RecentChanges => 'RecentChanges',
98 RefererDontRecord => 'Wiki//Referer//IgnoreSite',
99 RefererSiteName => 'Wiki//Referer//SiteName',
100 ResourceNS => 'Wiki//Resource//',
101 StyleList => 'Wiki//Style//List//',
102 UserAgentList => 'Wiki//UserAgentList',
103 AdminSpecialPage => "\x11\x11Admin\x11Special\x11Page\x11\x11",
104 );
105 $WIKI->{config}->{page} = {
106 Default => [qw/HomePage/],
107 NewPageTemplate => [qw/Wiki NewPageTemplate/],
108 };
109 our %PageOf = %{$WIKI->{config}->{page}};
110
111 $WIKI->{config}->{charset}->{internal} = 'euc-jp';
112 $WIKI->{config}->{charset}->{output} = 'iso-2022-jp';
113 $WIKI->{config}->{charset}->{uri_param} = ''; # auto detect
114 $WIKI->{config}->{charset}->{uri_query} = ''; # auto detect
115 our $kanjicode = 'euc'; # obsolete
116
117 $WIKI->{config}->{entity}->{expires} = {
118 edit => {delta => 60},
119 view => {delta => 2*3600},
120 lm_flaged => {delta => 30*24*3600},
121 };
122
123 ## Misc. options
124 $SuikaWiki::Plugin::UserAgent::LoggingName = 1;
125 ## Use UA-name log? (require UserAgent plugin module)
126
127 ## Definition of views
128
129 require SuikaWiki::View;
130
131 push @{$SuikaWiki::Plugin::On{Load}}, sub {
132 SuikaWiki::View->definition ('read')->property (template => <<'EOH');
133 %html-document(title=>{%res(name=>{View:WebPageTitle});}p,link-meta=>{%predefined-template(name=>links);}p,content=>{
134 %section(level=>1,add-to-toc=>0,type=>body,title=>{%ns-short-page-name;}p,heading,content=>{
135 %section(id=>tools1,class=>tools,add-to-toc=>0,content=>{%predefined-template(name=>navbar);}p);
136 %section(level=>2,id=>read,add-to-toc=>0,content=>{
137 %if-calender(month,true=>{
138 %format(context=>form_input,template=>{%calender;});
139 },false=>{
140 %if-calender(true=>{
141 %format(context=>form_input,template=>{%calender-months;});
142 });
143 });
144 %read(comment);
145 }p);
146 %section(level=>2,id=>children,title=>{%res(name=>{Children:Title});}p,heading,
147 content=>{%page-list(ns=>{%page-name;}p,recursive=>0,type=>both,template=>{%res(name=>{Children:Item});}p);}p);
148 %section(level=>2,id=>see-also,title=>{%res(name=>SeeAlso);}p,heading,content=>{%search-result;}p);
149 %section(level=>2,id=>referer,title=>{%res(name=>Referer);}p,heading,content=>{%referer-list;}p);
150 %section(level=>2,id=>toc,title=>{%res(name=>{TOC:Title});}p,heading,add_to_toc=>0,content=>{%toc(drag);}p);
151 %section(id=>last-modified,add_to_toc=>0,content=>{%res(name=>{LastModified=});%last-modified;}p);
152 %section(class=>tools,add_to_toc=>0,content=>{%predefined-template(name=>navbar);}p);
153 %section(id=>footer,add-to-toc=>0,content=>{%predefined-template(name=>footer);}p);
154 }p);
155 }p);%log-hotness;
156 EOH
157 SuikaWiki::View->definition ('wrote')->property (template => SuikaWiki::View->definition ('-wrote')->property ('template').q(%log-hotness(weight=>2);));
158 SuikaWiki::View->definition ('WithMenu')->property (template => SuikaWiki::View->definition ('WithMenu')->property ('template').q(%log-hotness;));
159 };
160
161 =head1 NAME
162
163 suikawiki-config.ph --- SuikaWiki: site configuration script
164
165 =head1 LICENSE
166
167 Copyright 2003 Wakaba <w@suika.fam.cx>
168
169 This program is free software; you can redistribute it and/or
170 modify it under the same terms as Perl itself.
171
172 =cut
173
174 1; # $Date: 2003/07/26 09:22:36 $

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24