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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by wakaba, Fri Jan 16 08:06:53 2004 UTC revision 1.10 by wakaba, Sun Feb 1 12:34:18 2004 UTC
# Line 1  Line 1 
1  package main;  =head1 NAME
2  use strict;  
3    suikawiki-config.ph - SuikaWiki: Configuration for SuikaWiki HTTP CGI Driver
4    
5    =head1 DESCRIPTION
6    
7    This is a configuration file for SuikaWiki Driver for HTTP CGI Script
8    (SWHCS).  Basic options such as WikiDB directory mapping and
9    special purpose WikiPage names can be customized with this file.
10    
11  ## [OBSOLETE] URI (or part of URI) of Wiki CGI script itself and its external addons  More complex customizing, e.g. modifying navigation bar or
12          ## Note: If your Wiki CGI script URI is <http://foo.example/path/to/wiki.cgi>,  adding new mode, is also possible by config.ph (generated from
13          ##              cookie-path: /path/to/  config.wp2) and WikiPlugin modules.  For more information,
14          ##              script-short-name: wiki.cgi  see <http://suika.fam.cx/~wakaba/-temp/wiki/wiki?SuikaWiki>.
         ##       URI parts MUST NOT contains "&" and/or non-URI characters.  
   our %uri = (  
     cookie_path         => '/~wakaba/-temp/expwiki/',  
     external_script     => '../wiki/script/',  
     script_short_name   => 'wiki',  
     ## If you use CVS repository of WikiDatabase,  
     #cvs_repository     => 'http://path-to-viewcvs/path-to-repository/',  
   );  
   $uri{wiki_abs} = "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}";  
   $main::url_cgi = $uri{wiki_abs};  
   $uri{wiki} = qq($uri{cookie_path}$uri{script_short_name});      
   
 ## Path to modules and databases  
   push @main::INC, qw'lib ../wiki/lib lib';  
   
 ## These lines should be removed after utf8 support  
 $Message::Util::Formatter::Base::Token = qr/[\w._+\x80-\xFF-]+/;  
 require Message::Util::Formatter::Base;  
   
 ## Constructing a new instance of the WikiEngine  
   require SuikaWiki::Implementation;  
   our $WIKI = SuikaWiki::Implementation->new;  
   
   ## Obsolete interface  
   our %PathTo = (       ## Path to your data, relative to the main CGI script (NOT to this config script)  
     CachePrefix         => q(./wikidata/.cache.),  # WikiPlugin  
     TempPrefix  => q(./wikidata/.tmp.),            # WikiPlugin, Image  
     convert     => q(/usr/X11R6/bin/convert),      # Image  
   );  
15    
16  ## Filesystem path mapping  This file is part of SuikaWiki.
17    
18    =cut
19    
20    package wiki::driver::http;
21    use strict;
22    
23    sub config ($) {
24      my $WIKI = shift;
25      
26      ## -- Filesystem path mapping
27    for (    for (
28         [db__cache__dir          => q"./wikidata/lock/"],
29       [db__content__dir        => q"./wikidata/page"],       [db__content__dir        => q"./wikidata/page"],
30       [db__content__error_log  => q"./wikidata/log/db-content.log"],       [db__content__error_log  => q"./wikidata/log/db-content.log"],
31       [db__lock__dir           => q"./wikidata/lock/"],       [db__lock__dir           => q"./wikidata/lock/"],
# Line 44  require Message::Util::Formatter::Base; Line 33  require Message::Util::Formatter::Base;
33      $WIKI->{config}->{path_to}->{$_->[0]} = $_->[1];      $WIKI->{config}->{path_to}->{$_->[0]} = $_->[1];
34    }    }
35    
36  ## Debug mode    ## -- Debug mode
37    $WIKI->{config}->{debug} = {    $WIKI->{config}->{debug} = {
38      general => 1,      general => 1,
39      db => 0,      db => 0,
40      view => 1,      view => 1,
41    };    };
42    
43  ## WikiPlugin    ## -- WikiPlugin
44    push @{$WIKI->{event}->{plugin_manager_loaded}}, sub {    push @{$WIKI->{event}->{plugin_manager_loaded}}, sub {
45      my $wiki = shift;      my $wiki = shift;
46        
47        ## Installed plugin modules
48      $wiki->{plugin}->load_directory (qw(      $wiki->{plugin}->load_directory (qw(
49        lib/SuikaWiki/Plugin/        lib/SuikaWiki/Plugin/
50        misc/plugins/        misc/plugins/
51          misc/plugins/form/
52        misc/plugins/format/        misc/plugins/format/
53          misc/plugins/link/
54        misc/plugins/view/        misc/plugins/view/
55      ));      ));
56        
57        ## Configuration file as pseudo-plugin module
58      require 'wikidata/config.ph';      require 'wikidata/config.ph';
59    };    };
60    
61  ## WikiDatabase : Mapping logical to physical    ## -- WikiDatabase: Mapping logical to physical
62    push @{$WIKI->{event}->{database_loaded}}, sub {    push @{$WIKI->{event}->{database_loaded}}, sub {
63          my $wiki = shift;
64          
65        ## Main content        ## Main content
66        $WIKI->{db}->_set_prop_db (content => {-db_open => sub {        $wiki->{db}->_set_prop_db (content => {-db_open => sub {
67          require SuikaWiki::DB::FileSystem::YukiWikiDBNS;          require SuikaWiki::DB::FileSystem::YukiWikiDBNS;
68          SuikaWiki::DB::FileSystem::YukiWikiDBNS->new          SuikaWiki::DB::FileSystem::YukiWikiDBNS->new
69            (directory => $WIKI->{config}->{path_to}->{db__content__dir},            (directory => $wiki->{config}->{path_to}->{db__content__dir},
70             logfile   => $WIKI->{config}->{path_to}->{db__content__error_log},             logfile   => $wiki->{config}->{path_to}->{db__content__error_log},
71             suffix    => '.txt',             suffix    => '.txt',
72             -lock => &{$WIKI->{var}->{db}->{lock_prop}} ('content'));             -lock => $wiki->{var}->{db}->{lock_prop}->('content'));
73        }, -db_close => sub {        }, -db_close => sub {
74          my %opt = @_;          my %opt = @_;
75          $opt{prop_info}->{-db}->close;          $opt{prop_info}->{-db}->close;
# Line 80  require Message::Util::Formatter::Base; Line 77  require Message::Util::Formatter::Base;
77        }});        }});
78                
79        ## Last modified        ## Last modified
80        $WIKI->{db}->_set_prop_db (lastmodified => {-db_open => sub {        $wiki->{db}->_set_prop_db (lastmodified => {-db_open => sub {
81          require SuikaWiki::DB::FileSystem::SuikaWikiMetaInfo09;          require SuikaWiki::DB::FileSystem::SuikaWikiMetaInfo09;
82          SuikaWiki::DB::FileSystem::SuikaWikiMetaInfo09->new          SuikaWiki::DB::FileSystem::SuikaWikiMetaInfo09->new
83            (directory => $WIKI->{config}->{path_to}->{db__content__dir},            (directory => $wiki->{config}->{path_to}->{db__content__dir},
84             -lock => &{$WIKI->{var}->{db}->{lock_prop}} ('lastmodified'));             -lock => $wiki->{var}->{db}->{lock_prop}->('lastmodified'));
85        }, -prop => 'last_modified', -db_close => sub {        }, -prop => 'last_modified', -db_close => sub {
86          my %opt = @_;          my %opt = @_;
87          $opt{prop_info}->{-db}->close;          $opt{prop_info}->{-db}->close;
88          delete $opt{prop_info}->{-db};          delete $opt{prop_info}->{-db};
89        }});        }});
90            
91    ## OBSOLETE interface for transition        ## Cache
92    ## Don't remove until WikiResource is reimplemented        require SuikaWiki::DB::FileSystem::SuikaWikiCache09;
93      $WIKI->{db}->get (content => ['dummy']);        my $cachedb = SuikaWiki::DB::FileSystem::SuikaWikiCache09->new
94      *main::database = $WIKI->{db}->{prop}->{content}->{-db}->{db_hash};              (directory => $wiki->{config}->{path_to}->{db__cache__dir});
95      $SuikaWiki::Plugin::DB = $WIKI->{db};        $wiki->{db}->_set_prop_db (m__search_result =>
96      for (@{$SuikaWiki::Plugin::On{WikiDatabaseLoaded}||[]}) { &{$_} }          {-db => $cachedb, -prop => 'search_result', -db_close => sub {
97                  my %opt = @_;
98      package wiki::dummy;            $opt{prop_info}->{-db}->close;
99      sub meta {undef};            delete $opt{prop_info}->{-db};
100      sub list_items {};          }});
101      sub STORE {};        $wiki->{db}->_set_prop_db (wpp__headsummary =>
102            {-db => $cachedb, -prop => 'headsummary', -db_close => sub {
103              my %opt = @_;
104              $opt{prop_info}->{-db}->close;
105              delete $opt{prop_info}->{-db};
106            }});
107          
108          ## Additional WikiDB properties should be defined here
109          # ...    
110    };    };
111    
112    ## WikiName of special purpose WikiPages    ## -- WikiName of special purpose WikiPages
113    $WIKI->{config}->{page} = {    $WIKI->{config}->{page} = {
114      Default         => [qw/HomePage/],      Default         => [qw/HomePage/],
115        InterWikiName   => [qw/Wiki InterWikiName/],
116      NewPageTemplate => [qw/Wiki NewPageTemplate/],      NewPageTemplate => [qw/Wiki NewPageTemplate/],
117    };    };
118        
119    ## [OBSOLETE] Name of Special WikiPage (linked as parts of navigations)    ## -- WikiNamespace constants
   our %PageName = (  
     FrontPage   => 'HomePage',  
     InterWikiName       => 'Wiki//InterWikiName',  
     MenuBar     => 'Wiki//MenuBar',  
     RefererDontRecord   => 'Wiki//Referer//IgnoreSite',  
     RefererSiteName     => 'Wiki//Referer//SiteName',  
     ResourceNS  => 'Wiki//Resource//',  
     StyleList   => 'Wiki//Style//List//',  
   );  
     
   ## WikiNamespace constants  
120    $WIKI->{config}->{name}->{space}->{separator} = '//';    $WIKI->{config}->{name}->{space}->{separator} = '//';
121    $WIKI->{config}->{name}->{space}->{separator_reg} = qr#//#;    $WIKI->{config}->{name}->{space}->{separator_reg} = qr#//#;
122        
123    ## Default character code    ## -- Default character codes
124    $WIKI->{config}->{charset}->{internal} = 'euc-jp';    $WIKI->{config}->{charset}->{internal} = 'euc-jp';
125    $WIKI->{config}->{charset}->{output} = 'iso-2022-jp';    $WIKI->{config}->{charset}->{output} = 'iso-2022-jp';
126    $WIKI->{config}->{charset}->{uri_param} = ''; # auto detect    $WIKI->{config}->{charset}->{uri_param} = ''; # auto detect
# Line 134  require Message::Util::Formatter::Base; Line 129  require Message::Util::Formatter::Base;
129    $WIKI->{config}->{charset}->{uri_query_encode} = 'euc-jp';    $WIKI->{config}->{charset}->{uri_query_encode} = 'euc-jp';
130    $WIKI->{config}->{charset}->{uri_path_info} = 'utf-8';    $WIKI->{config}->{charset}->{uri_path_info} = 'utf-8';
131        
132    ## Expires duration templates    ## -- Expires duration templates
133    $WIKI->{config}->{entity}->{expires} = {    $WIKI->{config}->{entity}->{expires} = {
134      edit      => {delta => 60},      edit      => {delta => 60},
135      view      => {delta => 2*3600},      view      => {delta => 2*3600},
136      lm_flaged => {delta => 30*24*3600},      lm_flaged => {delta => 30*24*3600},
137    };    };
138    
139    }
140    
141  =head1 NAME  =head1 SEE ALSO
142    
143  suikawiki-config.ph --- SuikaWiki: Configuration of the wiki  C<lib/suikawiki.pl>, C<wiki.cgi>,
144    <http://suika.fam.cx/~wakaba/-temp/wiki/wiki?SuikaWiki>,
145    <http://suika.fam.cx/~wakaba/-temp/wiki/wiki?SWHCS>
146    
147  =head1 LICENSE  =head1 LICENSE
148    
149  Copyright 2003 Wakaba <w@suika.fam.cx>  Copyright 2003-2004 Wakaba <w@suika.fam.cx>.  All rights reserved.
150    
151  This program is free software; you can redistribute it and/or  This program is free software; you can redistribute it and/or
152  modify it under the same terms as Perl itself.  modify it under the same terms as Perl itself.

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24