/[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.14 by wakaba, Thu Apr 22 05:45:14 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    BEGIN {
31      if ($main::ENV{REQUEST_URI} =~ /\#/) {
32        require SuikaWiki::Output::HTTP;
33        my $out = SuikaWiki::Output::HTTP->new;
34        $out->{status_code} = 401;
35        $out->{status_phrase} = q<Request-URI MUST NOT have Fragment Identifier>;
36        $out->{entity}->{media_type} = q<text/html>;
37        $out->{entity}->{charset} = q<iso-8859-1>;
38        $out->{entity}->{language} = [q<en>];
39        $out->{entity}->{body_is_octet_stream} = 1;
40        my $ua = $main::ENV{HTTP_USER_AGENT};
41        for ($ua) {
42          s/&/&amp;/g; s/</&lt;/g; s/([^\x20-\x7E])/sprintf '&#x%02X;', ord $1/ge;
43        };
44        $out->{entity}->{body} = qq<
45          <!DOCTYPE html SYSTEM>
46          <title>401 Bad Request-URI</title>
47          <h1>Bad Request-URI</h1>
48          <p>Your Request-URI has fragment identifier but it is not allowed here.
49          It might be a bug of your user agent ($ua).  Please contact to the UA
50          vendor.</p>
51        >;
52        $out->output (output => 'http-cgi');
53        exit;
54      }
55    }
56    
 use Message::Util::Error;  
57  push our @Config, sub ($) {  push our @Config, sub ($) {
58    my $WIKI = shift;    my $WIKI = shift;
59    use Cwd qw(abs_path);    use Cwd qw(abs_path);
60        
61    ## -- Filesystem path mapping    ## -- Filesystem path mapping
62    for (    for (
63       [db__cache__dir          => q"./wikidata/lock/"],       [db__cache__dir          => q"./wikidata/cache/"],
64       [db__cache_struct__file  => q"./wikidata/lock/struct.db"],       [db__cache_struct__file  => q"./wikidata/cache/struct.db"],
65       [db__content__dir        => q"./wikidata/page/"],       [db__content__dir        => q"./wikidata/page/"],
66       [db__content__error_log  => q"./wikidata/log/db-content.log"],       [db__content__error_log  => q"./wikidata/log/db-content.log"],
67       [db__bdb__home_dir       => q"./wikidata/lock/"],       [db__bdb__home_dir       => q"./wikidata/lock/"],
# Line 45  push our @Config, sub ($) { Line 72  push our @Config, sub ($) {
72       [db__lock__log_file      => q"./wikidata/log/lock.log"],       [db__lock__log_file      => q"./wikidata/log/lock.log"],
73       [db__log__dir            => q"./wikidata/log/"],       [db__log__dir            => q"./wikidata/log/"],
74       [db__temp__dir           => q"./wikidata/lock/"],       [db__temp__dir           => q"./wikidata/lock/"],
75         [namazu__index_dir       => q"/var/namazu/index/suikawiki"],
76    ) {    ) {
77      ## On system that does not set current directory as main script      ## On system that does not set current directory as main script
78      ## directory, you should specify it instead of using "abs_path".      ## directory, you should specify it instead of using "abs_path".
79      $WIKI->{config}->{path_to}->{$_->[0]} = abs_path $_->[1];      $WIKI->{config}->{path_to}->{$_->[0]} = abs_path $_->[1];
80    }    }
81      
82      ## -- Namazu URI Mapping (See SuikaWiki:SuikaWiki//Namazu) --
83      $WIKI->{config}->{nmz__uri_to_uri} = sub {
84        my ($nmzuri, %opt) = @_;
85        if ($nmzuri =~ s!^\Q$opt{o}->{wiki}->{config}->{path_to}->{db__content__dir}\E/*!!o) {
86          $nmzuri =~ s/\.txt$//;
87          return $opt{o}->{wiki}->uri_reference
88                          (page => $opt{o}->{wiki}->name ([
89            map {s/([0-9A-F][0-9A-F])/pack 'C', hex $1/ge; $_}
90            split m!\.ns/!, $nmzuri
91          ]), base => 1);
92        } else {
93          $nmzuri =~ s<^/home/wakaba/public_html/([^.]+)><http://suika.fam.cx/~wakaba/$1>;
94          return ($nmzuri, $nmzuri);
95        }
96      };
97    
98    ## -- WikiPlugin    ## -- WikiPlugin
99    push @{$WIKI->{event}->{plugin_manager_loaded}}, sub {    push @{$WIKI->{event}->{plugin_manager_loaded}}, sub {
# Line 75  push our @Config, sub ($) { Line 119  push our @Config, sub ($) {
119                
120        ## Main content        ## Main content
121        $wiki->{db}->_set_prop_db (content => {-db_open => sub {        $wiki->{db}->_set_prop_db (content => {-db_open => sub {
122          require SuikaWiki::DB::FileSystem::YukiWikiDBNS;          require SuikaWiki::DB::FileSystem::LeafFile;
123          SuikaWiki::DB::FileSystem::YukiWikiDBNS->new          SuikaWiki::DB::FileSystem::LeafFile->new
124            (directory => $wiki->{config}->{path_to}->{db__content__dir},            (base_directory => $wiki->{config}->{path_to}->{db__content__dir},
125             logfile   => $wiki->{config}->{path_to}->{db__content__error_log},             directory_suffix => '.ns',
126             suffix    => '.txt',             file_suffix    => '.txt',
127               root_key => $wiki->{config}->{page}->{Default},
128             -lock => $wiki->{var}->{db}->{lock_prop}->('content'));             -lock => $wiki->{var}->{db}->{lock_prop}->('content'));
129        }, -db_close => sub {        }, -db_close => sub {
130          my %opt = @_;          my %opt = @_;
# Line 102  push our @Config, sub ($) { Line 147  push our @Config, sub ($) {
147        ## Cache DBs        ## Cache DBs
148        require SuikaWiki::DB::FileSystem::SuikaWikiCache09;        require SuikaWiki::DB::FileSystem::SuikaWikiCache09;
149        my $cachedb = SuikaWiki::DB::FileSystem::SuikaWikiCache09->new        my $cachedb = SuikaWiki::DB::FileSystem::SuikaWikiCache09->new
150              (directory => $wiki->{config}->{path_to}->{db__cache__dir});              (directory => $wiki->{config}->{path_to}->{db__cache__dir},
151                 expires => 86400 * 3, removes => 86400 * 3); # 3 days
152        $wiki->{db}->_set_prop_db (m__search_result =>        $wiki->{db}->_set_prop_db (m__search_result =>
153          {-db => $cachedb, -prop => 'search_result', -db_close => sub {          {-db => $cachedb, -prop => 'search_result', -db_close => sub {
154            my %opt = @_;            my %opt = @_;
# Line 151  push our @Config, sub ($) { Line 197  push our @Config, sub ($) {
197                
198        ## Referer Database (See Referer plugin module)        ## Referer Database (See Referer plugin module)
199        $wiki->{db}->_set_prop_db (referer => {-db_open => sub {        $wiki->{db}->_set_prop_db (referer => {-db_open => sub {
200          require SuikaWiki::DB::Hash;          require SuikaWiki::DB::FileSystem::Count;
201          new SuikaWiki::DB::Hash constructor => sub {          SuikaWiki::DB::FileSystem::Count->new
202            tie my %db, 'BerkeleyDB::Hash',            (base_directory => $wiki->{config}->{path_to}->{db__content__dir},
203                          -Filename => 'referer.db',             directory_suffix => '.ns',
204                          -Env => $bdbenv,             file_suffix    => '.ref',
205                          -Flags => DB_CREATE,             root_key => $wiki->{config}->{page}->{Default},
206                          -Mode => 0644;             auto_mkdir => 0,
207            \%db;             -lock => $wiki->{var}->{db}->{lock_prop}->('referer'));
208         };        }, -db_close => sub {
209            my %opt = @_;
210            $opt{prop_info}->{-db}->close;
211            delete $opt{prop_info}->{-db};
212        }});        }});
213    
214        ## HTTP Request Logging Database (See RequestLog plugin module)        ## HTTP Request Logging Database (See RequestLog plugin module)
# Line 214  push our @Config, sub ($) { Line 263  push our @Config, sub ($) {
263      separator_reg => qr#\s*//\s*#,      separator_reg => qr#\s*//\s*#,
264      self => '.',      self => '.',
265      parent => '..',      parent => '..',
266        root => '//',
267    };    };
268        
269    ## -- Default character codes    ## -- Default character codes
# Line 237  push our @Config, sub ($) { Line 287  push our @Config, sub ($) {
287    $WIKI->{config}->{entity}->{expires} = {    $WIKI->{config}->{entity}->{expires} = {
288      edit      => {delta => 60},      edit      => {delta => 60},
289      view      => {delta => 2*3600},      view      => {delta => 2*3600},
290        list      => {delta => 60},
291      lm_flaged => {delta => 30*24*3600},      lm_flaged => {delta => 30*24*3600},
292      stylesheet => {delta => 30*24*3600},      stylesheet => {delta => 30*24*3600},
293      error     => {delta => 60},      error     => {delta => 60},

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24