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

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

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

revision 1.12.4.4 by wakaba, Sat Mar 13 13:16:59 2004 UTC revision 1.15 by wakaba, Sun Apr 25 07:13:16 2004 UTC
# Line 25  use strict; Line 25  use strict;
25      $Message::Util::Formatter::Base::Token = qr/[\w._+\x80-\xFF-]+/;      $Message::Util::Formatter::Base::Token = qr/[\w._+\x80-\xFF-]+/;
26      require Message::Util::Formatter::Base;      require Message::Util::Formatter::Base;
27    }    }
28      use Message::Util::Error;
29    
30    use Message::Util::QName::General [q<ExpandedURI>], {
31      'media-type' => q<http://suika.fam.cx/~wakaba/-temp/2004/04/24/mt#>,
32    };
33    
34    BEGIN {
35      if ($main::ENV{REQUEST_URI} =~ /\#/) {
36        require SuikaWiki::Output::HTTP;
37        my $out = SuikaWiki::Output::HTTP->new;
38        $out->{status_code} = 401;
39        $out->{status_phrase} = q<Request-URI MUST NOT have Fragment Identifier>;
40        $out->{entity}->{media_type} = q<text/html>;
41        $out->{entity}->{charset} = q<iso-8859-1>;
42        $out->{entity}->{language} = [q<en>];
43        $out->{entity}->{body_is_octet_stream} = 1;
44        my $ua = $main::ENV{HTTP_USER_AGENT};
45        for ($ua) {
46          s/&/&amp;/g; s/</&lt;/g; s/([^\x20-\x7E])/sprintf '&#x%02X;', ord $1/ge;
47        };
48        $out->{entity}->{body} = qq<
49          <!DOCTYPE html SYSTEM>
50          <title>401 Bad Request-URI</title>
51          <h1>Bad Request-URI</h1>
52          <p>Your Request-URI has fragment identifier but it is not allowed here.
53          It might be a bug of your user agent ($ua).  Please contact to the UA
54          vendor.</p>
55        >;
56        $out->output (output => 'http-cgi');
57        exit;
58      }
59    }
60    
 use Message::Util::Error;  
61  push our @Config, sub ($) {  push our @Config, sub ($) {
62    my $WIKI = shift;    my $WIKI = shift;
63    use Cwd qw(abs_path);    use Cwd qw(abs_path);
64        
65    ## -- Filesystem path mapping    ## -- Filesystem path mapping
66    for (    for (
67       [db__cache__dir          => q"./wikidata/lock/"],       [db__cache__dir          => q"./wikidata/cache/"],
68       [db__cache_struct__file  => q"./wikidata/lock/struct.db"],       [db__cache_struct__file  => q"./wikidata/cache/struct.db"],
69       [db__content__dir        => q"./wikidata/page/"],       [db__content__dir        => q"./wikidata/page/"],
70       [db__content__error_log  => q"./wikidata/log/db-content.log"],       [db__content__error_log  => q"./wikidata/log/db-content.log"],
71       [db__bdb__home_dir       => q"./wikidata/lock/"],       [db__bdb__home_dir       => q"./wikidata/lock/"],
# Line 45  push our @Config, sub ($) { Line 76  push our @Config, sub ($) {
76       [db__lock__log_file      => q"./wikidata/log/lock.log"],       [db__lock__log_file      => q"./wikidata/log/lock.log"],
77       [db__log__dir            => q"./wikidata/log/"],       [db__log__dir            => q"./wikidata/log/"],
78       [db__temp__dir           => q"./wikidata/lock/"],       [db__temp__dir           => q"./wikidata/lock/"],
79         [namazu__index_dir       => q"/var/namazu/index/suikawiki"],
80    ) {    ) {
81      ## On system that does not set current directory as main script      ## On system that does not set current directory as main script
82      ## directory, you should specify it instead of using "abs_path".      ## directory, you should specify it instead of using "abs_path".
83      $WIKI->{config}->{path_to}->{$_->[0]} = abs_path $_->[1];      $WIKI->{config}->{path_to}->{$_->[0]} = abs_path $_->[1];
84    }    }
85      
86      ## -- Namazu URI Mapping (See SuikaWiki:SuikaWiki//Namazu) --
87      $WIKI->{config}->{nmz__uri_to_uri} = sub {
88        my ($nmzuri, %opt) = @_;
89        if ($nmzuri =~ s!^\Q$opt{o}->{wiki}->{config}->{path_to}->{db__content__dir}\E/*!!o) {
90          $nmzuri =~ s/\.txt$//;
91          return $opt{o}->{wiki}->uri_reference
92                          (page => $opt{o}->{wiki}->name ([
93            map {s/([0-9A-F][0-9A-F])/pack 'C', hex $1/ge; $_}
94            split m!\.ns/!, $nmzuri
95          ]), base => 1);
96        } else {
97          $nmzuri =~ s<^/home/wakaba/public_html/([^.]+)><http://suika.fam.cx/~wakaba/$1>;
98          return ($nmzuri, $nmzuri);
99        }
100      };
101    
102    ## -- WikiPlugin    ## -- WikiPlugin
103    push @{$WIKI->{event}->{plugin_manager_loaded}}, sub {    push @{$WIKI->{event}->{plugin_manager_loaded}}, sub {
# Line 75  push our @Config, sub ($) { Line 123  push our @Config, sub ($) {
123                
124        ## Main content        ## Main content
125        $wiki->{db}->_set_prop_db (content => {-db_open => sub {        $wiki->{db}->_set_prop_db (content => {-db_open => sub {
126          require SuikaWiki::DB::FileSystem::YukiWikiDBNS;          require SuikaWiki::DB::FileSystem::LeafFile;
127          SuikaWiki::DB::FileSystem::YukiWikiDBNS->new          SuikaWiki::DB::FileSystem::LeafFile->new
128            (directory => $wiki->{config}->{path_to}->{db__content__dir},            (base_directory => $wiki->{config}->{path_to}->{db__content__dir},
129             logfile   => $wiki->{config}->{path_to}->{db__content__error_log},             directory_suffix => '.ns',
130             suffix    => '.txt',             file_suffix    => '.txt',
131               root_key => $wiki->{config}->{page}->{Default},
132               -lock => $wiki->{var}->{db}->{lock_prop}->('content_prop'));
133          }, -db_close => sub {
134            my %opt = @_;
135            $opt{prop_info}->{-db}->close;
136            delete $opt{prop_info}->{-db};
137          }});
138    
139          ## Properties
140          $wiki->{db}->_set_prop_db (content_prop => {-db_open => sub {
141            require SuikaWiki::DB::FileSystem::LeafProp;
142            SuikaWiki::DB::FileSystem::LeafProp->new
143              (base_directory => $wiki->{config}->{path_to}->{db__content__dir},
144               directory_suffix => '.ns',
145               file_suffix    => '.prop',
146               root_key => $wiki->{config}->{page}->{Default},
147             -lock => $wiki->{var}->{db}->{lock_prop}->('content'));             -lock => $wiki->{var}->{db}->{lock_prop}->('content'));
148        }, -db_close => sub {        }, -db_close => sub {
149          my %opt = @_;          my %opt = @_;
# Line 102  push our @Config, sub ($) { Line 166  push our @Config, sub ($) {
166        ## Cache DBs        ## Cache DBs
167        require SuikaWiki::DB::FileSystem::SuikaWikiCache09;        require SuikaWiki::DB::FileSystem::SuikaWikiCache09;
168        my $cachedb = SuikaWiki::DB::FileSystem::SuikaWikiCache09->new        my $cachedb = SuikaWiki::DB::FileSystem::SuikaWikiCache09->new
169              (directory => $wiki->{config}->{path_to}->{db__cache__dir});              (directory => $wiki->{config}->{path_to}->{db__cache__dir},
170                 expires => 86400 * 3, removes => 86400 * 3); # 3 days
171        $wiki->{db}->_set_prop_db (m__search_result =>        $wiki->{db}->_set_prop_db (m__search_result =>
172          {-db => $cachedb, -prop => 'search_result', -db_close => sub {          {-db => $cachedb, -prop => 'search_result', -db_close => sub {
173            my %opt = @_;            my %opt = @_;
# Line 151  push our @Config, sub ($) { Line 216  push our @Config, sub ($) {
216                
217        ## Referer Database (See Referer plugin module)        ## Referer Database (See Referer plugin module)
218        $wiki->{db}->_set_prop_db (referer => {-db_open => sub {        $wiki->{db}->_set_prop_db (referer => {-db_open => sub {
219          require SuikaWiki::DB::Hash;          require SuikaWiki::DB::FileSystem::Count;
220          new SuikaWiki::DB::Hash constructor => sub {          SuikaWiki::DB::FileSystem::Count->new
221            tie my %db, 'BerkeleyDB::Hash',            (base_directory => $wiki->{config}->{path_to}->{db__content__dir},
222                          -Filename => 'referer.db',             directory_suffix => '.ns',
223                          -Env => $bdbenv,             file_suffix    => '.ref',
224                          -Flags => DB_CREATE,             root_key => $wiki->{config}->{page}->{Default},
225                          -Mode => 0644;             auto_mkdir => 0,
226            \%db;             -lock => $wiki->{var}->{db}->{lock_prop}->('referer'));
227         };        }, -db_close => sub {
228            my %opt = @_;
229            $opt{prop_info}->{-db}->close;
230            delete $opt{prop_info}->{-db};
231        }});        }});
232    
233        ## HTTP Request Logging Database (See RequestLog plugin module)        ## HTTP Request Logging Database (See RequestLog plugin module)
# Line 214  push our @Config, sub ($) { Line 282  push our @Config, sub ($) {
282      separator_reg => qr#\s*//\s*#,      separator_reg => qr#\s*//\s*#,
283      self => '.',      self => '.',
284      parent => '..',      parent => '..',
285        root => '//',
286    };    };
287        
288    ## -- Default character codes    ## -- Default character codes
# Line 232  push our @Config, sub ($) { Line 301  push our @Config, sub ($) {
301      ## Fragment identifier in URI reference      ## Fragment identifier in URI reference
302        uri_fragment => 'x-punycode',     ## Reserved for possible future use        uri_fragment => 'x-punycode',     ## Reserved for possible future use
303    };    };
304    
305      ## -- User option for media types
306      $WIKI->{config}->{ExpandedURI q<media-type:accept-media-type>} = {
307        q<IMT:text/css##> => 1,
308        q<IMT:text/plain##> => 1,
309        q<IMT:text/x-suikawiki;version="0.9"##> => 1,
310        q<IMT:application/x.suikawiki.config;version="2.0"##> => 1,
311      };
312        
313    ## -- Expires duration templates    ## -- Expires duration templates
314    $WIKI->{config}->{entity}->{expires} = {    $WIKI->{config}->{entity}->{expires} = {
315      edit      => {delta => 60},      edit      => {delta => 60},
316      view      => {delta => 2*3600},      view      => {delta => 2*3600},
317        list      => {delta => 60},
318      lm_flaged => {delta => 30*24*3600},      lm_flaged => {delta => 30*24*3600},
319      stylesheet => {delta => 30*24*3600},      stylesheet => {delta => 30*24*3600},
320      error     => {delta => 60},      error     => {delta => 60},

Legend:
Removed from v.1.12.4.4  
changed lines
  Added in v.1.15

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24