21 |
$uri{wiki} = qq($uri{cookie_path}$uri{script_short_name}); |
$uri{wiki} = qq($uri{cookie_path}$uri{script_short_name}); |
22 |
|
|
23 |
## Path to modules and databases |
## Path to modules and databases |
24 |
push @main::INC, 'lib'; |
use lib 'lib'; |
25 |
push @SuikaWiki::Plugin::plugin_directory, ( |
push @SuikaWiki::Plugin::plugin_directory, ( |
26 |
q(lib/SuikaWiki/Plugin/), |
q(lib/SuikaWiki/Plugin/), |
27 |
q(misc/plugins/), |
q(misc/plugins/), |
35 |
convert => q(/usr/X11R6/bin/convert), |
convert => q(/usr/X11R6/bin/convert), |
36 |
); |
); |
37 |
|
|
38 |
|
BEGIN { |
39 |
|
require SuikaWiki::Output::CGICarp; |
40 |
|
$SuikaWiki::Output::CGICarp::CUSTOM_REASON_TEXT = 'Internal WikiEngine Error'; |
41 |
|
CGI::Carp::set_message (sub { |
42 |
|
my $msg = shift; |
43 |
|
print STDOUT <<EOH |
44 |
|
<!DOCTYPE html SYSTEM> |
45 |
|
<title>$SuikaWiki::Output::CGICarp::CUSTOM_STATUS_CODE $SuikaWiki::Output::CGICarp::CUSTOM_REASON_TEXT</title> |
46 |
|
<h1>$SuikaWiki::Output::CGICarp::CUSTOM_REASON_TEXT</h1> |
47 |
|
<p>$msg</p> |
48 |
|
EOH |
49 |
|
}); |
50 |
|
} |
51 |
|
|
52 |
require SuikaWiki::DB::Util::Lock; |
require SuikaWiki::DB::Util::Lock; |
53 |
our $locker = SuikaWiki::DB::Util::Lock->new (-directory => q(./wikidata/lock), |
our $locker = SuikaWiki::DB::Util::Lock->new (-directory => q(./wikidata/lock), |
54 |
-name => 'wikipage', |
-name => 'wikipage', |
55 |
-retry => ($main::ENV{HTTP_USER_AGENT} =~ m#Openbot/3# ? 2 : 80), |
-retry => ($main::ENV{HTTP_USER_AGENT} =~ m#Openbot/3# ? 2 : 20), |
56 |
-timeout => 300, |
-timeout => 3000, |
57 |
-error_handler => sub { |
-error_handler => sub { |
58 |
my ($self, %o) = @_; |
my ($self, %o) = @_; |
59 |
|
if ($o{level} eq 'fatal') { |
60 |
open LOG, '>>', $main::PathTo{WikiDatabaseErrorLog}; |
open LOG, '>>', $main::PathTo{WikiDatabaseErrorLog}; |
61 |
print LOG scalar (gmtime)."\@@{[time]} @{[$$]} {$o{level}}: ", $o{msg}, "\n"; |
print LOG scalar (gmtime)."\@@{[time]} @{[$$]} {$o{level}}: ", $o{msg}, "\n"; |
62 |
close LOG; |
close LOG; |
|
if ($o{level} eq 'fatal') { |
|
63 |
die $o{msg}; |
die $o{msg}; |
64 |
} |
} |
65 |
}); |
}); |
67 |
open LOG, '>>', $main::PathTo{WikiDatabaseErrorLog}; |
open LOG, '>>', $main::PathTo{WikiDatabaseErrorLog}; |
68 |
print LOG scalar (time), " Can't lock\n"; |
print LOG scalar (time), " Can't lock\n"; |
69 |
close LOG; |
close LOG; |
70 |
die "Can't lock"; |
print "Status: 423 Locked\n"; |
71 |
|
$SuikaWiki::Output::CGICarp::CUSTOM_STATUS_CODE = 423; |
72 |
|
die "Can't lock --- already locked; please try again"; |
73 |
}; |
}; |
74 |
|
|
75 |
|
|