From 54fe762e2d9ee1773359819acc4cff877e741592 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Wed, 20 Apr 2016 15:59:58 -0300 Subject: [PATCH] Bug 16222: (QA followup) Add /api dir for the API Signed-off-by: Tomas Cohen Arazi --- Makefile.PL | 6 +++++- etc/koha-httpd.conf | 10 +++++----- rewrite-config.PL | 1 + 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index 200617f..67faac9 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -260,7 +260,7 @@ my $target_map = { './about.pl' => 'INTRANET_CGI_DIR', './acqui' => 'INTRANET_CGI_DIR', './admin' => 'INTRANET_CGI_DIR', - './api' => 'INTRANET_CGI_DIR', + './api' => 'API_CGI_DIR', './authorities' => 'INTRANET_CGI_DIR', './basket' => 'INTRANET_CGI_DIR', './C4' => 'PERL_MODULE_DIR', @@ -1219,6 +1219,7 @@ sub get_target_directories { my %dirmap = (); my %skipdirs = (); if ($mode eq 'single') { + $dirmap{'API_CGI_DIR'} = File::Spec->catdir(@basedir, $package, 'api'); $dirmap{'INTRANET_CGI_DIR'} = File::Spec->catdir(@basedir, $package, 'intranet', 'cgi-bin'); $dirmap{'INTRANET_TMPL_DIR'} = File::Spec->catdir(@basedir, $package, 'intranet', 'htdocs', 'intranet-tmpl'); $dirmap{'INTRANET_WWW_DIR'} = File::Spec->catdir(@basedir, $package, 'intranet', 'htdocs'); @@ -1242,6 +1243,8 @@ sub get_target_directories { $dirmap{'ZEBRA_RUN_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'run', 'zebradb'); } elsif ($mode eq 'dev') { my $curdir = File::Spec->rel2abs(File::Spec->curdir()); + $dirmap{'API_CGI_DIR'} = File::Spec->catdir($curdir, 'api'); + $skipdirs{'API_CGI_DIR'} = 1; $dirmap{'INTRANET_CGI_DIR'} = File::Spec->catdir($curdir); $skipdirs{'INTRANET_CGI_DIR'} = 1; $dirmap{'INTRANET_TMPL_DIR'} = File::Spec->catdir($curdir, 'koha-tmpl', 'intranet-tmpl'); @@ -1275,6 +1278,7 @@ sub get_target_directories { $dirmap{'ZEBRA_RUN_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'run', 'zebradb'); } else { # mode is standard, i.e., 'fhs' + $dirmap{'API_CGI_DIR'} = File::Spec->catdir(@basedir, $package, 'api'); $dirmap{'INTRANET_CGI_DIR'} = File::Spec->catdir(@basedir, $package, 'intranet', 'cgi-bin'); $dirmap{'INTRANET_TMPL_DIR'} = File::Spec->catdir(@basedir, $package, 'intranet', 'htdocs', 'intranet-tmpl'); $dirmap{'INTRANET_WWW_DIR'} = File::Spec->catdir(@basedir, $package, 'intranet', 'htdocs'); diff --git a/etc/koha-httpd.conf b/etc/koha-httpd.conf index 32cdf0a..1e1e569 100644 --- a/etc/koha-httpd.conf +++ b/etc/koha-httpd.conf @@ -114,8 +114,8 @@ RewriteRule ^/issn/([^\/]*)/?$ /search?q=issn:$1 [PT] # REST API configuration - Alias "/api" "__OPAC_CGI_DIR__/api" - + Alias "/api" "__API_CGI_DIR__" + Options +ExecCGI +FollowSymlinks AddHandler cgi-script .pl @@ -233,8 +233,8 @@ # REST API configuration - Alias "/api" "__INTRANET_CGI_DIR__/api" - + Alias "/api" "__API_CGI_DIR__" + Options +ExecCGI +FollowSymlinks AddHandler cgi-script .pl @@ -261,7 +261,7 @@ # ErrorLog __LOG_DIR__/koha-api-error_log # # -# +# # Options +ExecCGI +FollowSymlinks # AddHandler cgi-script .pl # diff --git a/rewrite-config.PL b/rewrite-config.PL index 3239a59..a66b119 100644 --- a/rewrite-config.PL +++ b/rewrite-config.PL @@ -103,6 +103,7 @@ $prefix = $ENV{'INSTALL_BASE'} || "/usr"; "__ZEBRA_PASS__" => "zebrastripes", "__ZEBRA_USER__" => "kohauser", '__BACKUP_DIR__' => "$prefix/var/spool", + '__API_CGI_DIR__' => "$prefix/api", '__INTRANET_CGI_DIR__' => "$prefix/intranet/cgi-bin", '__INTRANET_TMPL_DIR__' => "$prefix/intranet/templates", '__INTRANET_WWW_DIR__' => "$prefix/intranet/www", -- 2.7.4