View | Details | Raw Unified | Return to bug 20630
Collapse All | Expand All

(-)a/Koha/App/Koha.pm (-1 / +12 lines)
Lines 13-19 sub startup { Link Here
13
    my ($self) = @_;
13
    my ($self) = @_;
14
14
15
    push @{$self->plugins->namespaces}, 'Koha::App::Plugin';
15
    push @{$self->plugins->namespaces}, 'Koha::App::Plugin';
16
    push @{$self->static->paths}, $self->home->rel_file('koha-tmpl');
16
    push @{$self->static->paths}, '/usr/share/koha/opac/htdocs';
17
    push @{$self->static->paths}, '/usr/share/koha/intranet/htdocs';
18
19
    # Load config
20
    $self->plugin('Config', {file => '/etc/koha/app.conf'});
17
21
18
    # Create route for all CGI scripts, need to be loaded first because of
22
    # Create route for all CGI scripts, need to be loaded first because of
19
    # CGI::Compile
23
    # CGI::Compile
Lines 46-51 sub startup { Link Here
46
50
47
    $r->any('/')->to(cb => sub { shift->redirect_to('/cgi-bin/koha/opac-main.pl') });
51
    $r->any('/')->to(cb => sub { shift->redirect_to('/cgi-bin/koha/opac-main.pl') });
48
    $r->any('/intranet')->to(cb => sub { shift->redirect_to('/cgi-bin/koha/mainpage.pl') });
52
    $r->any('/intranet')->to(cb => sub { shift->redirect_to('/cgi-bin/koha/mainpage.pl') });
53
    $r->any('/*')->to(cb => sub { shift->redirect_to('/cgi-bin/koha/errors/404.pl') });
49
}
54
}
50
55
51
sub _before_dispatch {
56
sub _before_dispatch {
Lines 57-62 sub _before_dispatch { Link Here
57
    # Remove Koha version from URL
62
    # Remove Koha version from URL
58
    $url =~ s/_\d{2}\.\d{7}\.(js|css)/.$1/;
63
    $url =~ s/_\d{2}\.\d{7}\.(js|css)/.$1/;
59
64
65
    # Set caches for static content
66
    if ($url =~ /\.(js|css|gif|png)$/) {
67
        $c->res->headers->cache_control('public');
68
        $c->res->headers->expires(Mojo::Date->new(time+86400));
69
    }
70
60
    # See FIXME above
71
    # See FIXME above
61
    if ($url =~ m|^/api/v|) {
72
    if ($url =~ m|^/api/v|) {
62
        $url = '/api' . $url;
73
        $url = '/api' . $url;
(-)a/Koha/App/Plugin/CGIBinKoha.pm (-4 / +9 lines)
Lines 32-42 sub register { Link Here
32
        # Guess if it's an OPAC script, or an Intranet script
32
        # Guess if it's an OPAC script, or an Intranet script
33
        # FIXME: errors scripts (400.pl, 401.pl, ...) exist in both intranet and
33
        # FIXME: errors scripts (400.pl, 401.pl, ...) exist in both intranet and
34
        # opac. The intranet ones will never be executed
34
        # opac. The intranet ones will never be executed
35
        if (-e $c->app->home->rel_file("opac/$script")) {
36
            $script = "opac/$script";
37
        }
38
35
39
        unless (-e $c->app->home->rel_file($script)) {
36
        my $base = $app->config->{basepath};
37
38
        if (-e "$base/opac/cgi-bin/opac/$script") {
39
            $script = "$base/opac/cgi-bin/opac/$script";
40
        }
41
        elsif (-e "$base/intranet/cgi-bin/$script") {
42
            $script = "$base/intranet/cgi-bin/$script";
43
        }
44
        else {
40
            return $c->reply->not_found;
45
            return $c->reply->not_found;
41
        }
46
        }
42
47
(-)a/etc/app.conf (+8 lines)
Line 0 Link Here
1
{
2
  basepath => '/usr/share/koha',
3
  hypnotoad => {
4
    listen  => ['http://127.0.0.1:3000'],
5
    workers => 10,
6
    pid_file => '/run/koha/koha-app.pid'
7
  }
8
};
(-)a/etc/systemd/koha-app.service (+15 lines)
Line 0 Link Here
1
[Unit]
2
Description=Koha ILMS Mojolicious App
3
After=network.target local-fs.target
4
5
[Service]
6
Type=forking
7
PIDFile=/run/koha/koha-app.pid
8
ExecStart=/usr/bin/hypnotoad ./bin/koha
9
ExecReload=/usr/bin/hypnotoad ./bin/koha
10
KillMode=process
11
WorkingDirectory=/usr/share/koha
12
Environment=MOJO_LOG_LEVEL=warn
13
14
[Install]
15
WantedBy=multi-user.target

Return to bug 20630