=head1 NAME suikawiki-config.ph - SuikaWiki: Configuration for SuikaWiki HTTP CGI Driver =head1 DESCRIPTION This is a configuration file for SuikaWiki Driver for HTTP CGI Script (SWHCS). Basic options such as WikiDB directory mapping and special purpose WikiPage names can be customized with this file. More complex customizing, e.g. modifying navigation bar or adding new mode, is also possible by config.ph (generated from config.wp2) and WikiPlugin modules. For more information, see . This file is part of SuikaWiki. =cut package wiki::driver::http; use strict; ## 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; use Message::Util::QName::General [q], { 'media-type' => q, }; push our @Config, sub ($) { my $WIKI = shift; use FindBin q($Bin); use File::Spec; ## -- Filesystem path mapping for ( [db__cache__dir => q"./wikidata/cache/"], [db__cache_struct__file => q"./wikidata/cache/struct.db"], [db__content__dir => q"./wikidata/page/"], [db__content__error_log => q"./wikidata/log/db-content.log"], [db__bdb__home_dir => q"./wikidata/lock/"], [db__bdb__log_dir => q"./wikidata/log/bdb/"], [db__bdb__log_file => q"./wikidata/log/bdb.log"], [db__bdb__temp_dir => q"./wikidata/lock/"], [db__lock__dir => q"./wikidata/lock/"], [db__lock__log_file => q"./wikidata/log/lock.log"], [db__log__dir => q"./wikidata/log/"], [db__temp__dir => q"./wikidata/lock/"], # [namazu__index_dir => q"/var/namazu/index/wiki"], ) { ## On system that does not set current directory as main script ## directory, you should specify it instead of using "abs_path". $WIKI->{config}->{path_to}->{$_->[0]} = File::Spec->rel2abs ($_->[1], $Bin); } =begin comment ## -- Namazu URI Mapping (See SuikaWiki:SuikaWiki//Namazu) -- $WIKI->{config}->{nmz__uri_to_uri} = sub { my ($nmzuri, %opt) = @_; if ($nmzuri =~ s!^\Q$opt{o}->{wiki}->{config}->{path_to}->{db__content__dir}\E/*!!o) { $nmzuri =~ s/\.txt$//; return $opt{o}->{wiki}->uri_reference (page => $opt{o}->{wiki}->name ([ map {s/([0-9A-F][0-9A-F])/pack 'C', hex $1/ge; $_} split m!\.ns/!, $nmzuri ]), base => 1); } else { return ($nmzuri, $nmzuri); } }; =end comment =cut ## -- WikiPlugin push @{$WIKI->{event}->{plugin_manager_loaded}}, sub { my $wiki = shift; ## Installed plugin modules $wiki->{plugin}->load_directory (qw( lib/SuikaWiki/Plugin/ misc/plugins/ misc/plugins/form/ misc/plugins/format/ misc/plugins/link/ misc/plugins/view/ )); ## Configuration file as pseudo-plugin module require 'wikidata/config.ph'; }; ## -- WikiDatabase: Mapping logical to physical push @{$WIKI->{event}->{database_loaded}}, sub { my $wiki = shift; ## Main content $wiki->{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')); }, -db_close => sub { my %opt = @_; $opt{prop_info}->{-db}->close; delete $opt{prop_info}->{-db}; }}); ## Properties $wiki->{db}->_set_prop_db (content_prop => {-db_open => sub { require SuikaWiki::DB::FileSystem::LeafProp; SuikaWiki::DB::FileSystem::LeafProp->new (base_directory => $wiki->{config}->{path_to}->{db__content__dir}, directory_suffix => '.ns', file_suffix => '.prop', root_key => $wiki->{config}->{page}->{Default}, -lock => $wiki->{var}->{db}->{lock_prop}->('content_prop')); }, -db_close => sub { my %opt = @_; $opt{prop_info}->{-db}->close; delete $opt{prop_info}->{-db}; }}); ## Last modified $wiki->{db}->_set_prop_db (lastmodified => {-db_open => sub { require SuikaWiki::DB::FileSystem::SuikaWikiMetaInfo09; SuikaWiki::DB::FileSystem::SuikaWikiMetaInfo09->new (directory => $wiki->{config}->{path_to}->{db__content__dir}, -lock => $wiki->{var}->{db}->{lock_prop}->('lastmodified')); }, -prop => 'last_modified', -db_close => sub { my %opt = @_; $opt{prop_info}->{-db}->close; delete $opt{prop_info}->{-db}; }}); ## Cache DBs require SuikaWiki::DB::FileSystem::SuikaWikiCache09; my $cachedb = SuikaWiki::DB::FileSystem::SuikaWikiCache09->new (directory => $wiki->{config}->{path_to}->{db__cache__dir}, expires => 86400 * 3, removes => 86400 * 3); # 3 days $wiki->{db}->_set_prop_db (m__search_result => {-db => $cachedb, -prop => 'search_result', -db_close => sub { my %opt = @_; $opt{prop_info}->{-db}->close; delete $opt{prop_info}->{-db}; }}); $wiki->{db}->_set_prop_db (wpp__headsummary => {-db => $cachedb, -prop => 'headsummary', -db_close => sub { my %opt = @_; $opt{prop_info}->{-db}->close; delete $opt{prop_info}->{-db}; }}); $wiki->{db}->_set_prop_db (ref__item_template => {-db => $cachedb, -prop => 'refereritem', -db_close => sub { my %opt = @_; $opt{prop_info}->{-db}->close; delete $opt{prop_info}->{-db}; }}); ## Referer Database (See Referer plugin module) $wiki->{db}->_set_prop_db (referer => {-db_open => sub { require SuikaWiki::DB::FileSystem::Count; SuikaWiki::DB::FileSystem::Count->new (base_directory => $wiki->{config}->{path_to}->{db__content__dir}, directory_suffix => '.ns', file_suffix => '.ref', root_key => $wiki->{config}->{page}->{Default}, auto_mkdir => 0, -lock => $wiki->{var}->{db}->{lock_prop}->('referer')); }, -db_close => sub { my %opt = @_; $opt{prop_info}->{-db}->close; delete $opt{prop_info}->{-db}; }}); ## Additional WikiDB properties should be defined here # ... }; ## -- WikiName of special purpose WikiPages $WIKI->{config}->{page} = { Default => $WIKI->name ([qw/HomePage/]), InterWikiName => $WIKI->name ([qw/Wiki InterWikiName/]), NewPageTemplate => $WIKI->name ([qw/Wiki NewPageTemplate/]), 'StyleSheetList(text/html)' => $WIKI->name ([qw]), }; ## -- WikiNamespace constants $WIKI->{config}->{name}->{space} = { separator => '//', separator_reg => qr#\s*//\s*#, self => '.', parent => '..', root => '//', }; ## -- Default character codes $WIKI->{config}->{charset} = { ## Internal code - MUST be ASCII + 8bit coding scheme internal => 'euc-jp', ## Default output code output => 'iso-2022-jp', ## "query" part in URI reference uri_query => '', # auto-detected uri_query_encode => 'euc-jp', ## For compatibility w/ SuikaWiki 2 uri_param => '', # auto-detected uri_param_encode => 'euc-jp', ## For compatibility w/ SuikaWiki 2 ## PATH_INFO part in URI reference uri_path_info => 'x-utf-8-10646', ## Reserved for future use ## Fragment identifier in URI reference uri_fragment => 'x-punycode', ## Reserved for possible future use }; ## -- User option for media types $WIKI->{config}->{ExpandedURI q} = { q => 1, q => 1, q => 1, q => 1, }; ## -- Expires duration templates $WIKI->{config}->{entity}->{expires} = { edit => {delta => 60}, view => {delta => 2*3600}, list => {delta => 60}, lm_flaged => {delta => 30*24*3600}, stylesheet => {delta => 30*24*3600}, error => {delta => 60}, }; ## -- Debug mode $WIKI->{config}->{debug} = { general => 0, db => 0, format => 0, view => 0, }; }; =head1 SEE ALSO C, C, , =head1 LICENSE Copyright 2003-2004 Wakaba . All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut 1; # $Date: 2005/01/21 14:38:15 $