From d90d8c9b272061986c101763d7c8f73ed7a9b0a2 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 29 Mar 2018 10:25:43 -0300 Subject: [PATCH] Bug 20428: Add the option to specify a tmp uploads dir This patch adds an option to the koha-conf.xml file for specifying a temporary uploaded files directory. The koha-create script is adjusted to handle it and a convenient option switch is added. If ommited, it will default to /var/lib/koha//uploads_tmp. koha-create-dirs is patched to create the required directory with the right permissions. The docs get the new parameter documented. Signed-off-by: Kyle M Hall Signed-off-by: Mark Tompsett Signed-off-by: Marcel de Rooy Signed-off-by: Jonathan Druart --- debian/docs/koha-create.xml | 9 +++++++++ debian/scripts/koha-create | 21 +++++++++++++++++++++ debian/scripts/koha-create-dirs | 1 + debian/templates/koha-conf-site.xml.in | 1 + etc/koha-conf.xml | 1 + 5 files changed, 33 insertions(+) diff --git a/debian/docs/koha-create.xml b/debian/docs/koha-create.xml index 77a3e7d7f8..07c1052ffe 100644 --- a/debian/docs/koha-create.xml +++ b/debian/docs/koha-create.xml @@ -42,6 +42,7 @@ directory time/zone directory + directory | @@ -201,6 +202,14 @@ + + + + Specify a for storing the temporarily uploaded files of the instance. + It defaults to /var/lib/koha/instance/uploads_tmp. + + + diff --git a/debian/scripts/koha-create b/debian/scripts/koha-create index 65d62bd8df..88232eb353 100755 --- a/debian/scripts/koha-create +++ b/debian/scripts/koha-create @@ -74,6 +74,8 @@ Options: --timezone time/zone Specify a timezone. e.g. America/Argentina --upload-path dir Set a user defined upload_path. It defaults to /var/lib/koha//uploads + --upload-tmp-path dir Set a user defined upload_tmp_path. It defaults to + /var/lib/koha//uploads_tmp --letsencrypt Set up a https-only site with letsencrypt certificates --help,-h Show this help. @@ -118,6 +120,7 @@ generate_config_file() { -e "s#__TEMPLATE_CACHE_DIR__#$TEMPLATE_CACHE_DIR#g" \ -e "s#__TIMEZONE__#$TIMEZONE#g" \ -e "s#__UPLOAD_PATH__#$UPLOAD_PATH#g" \ + -e "s#__UPLOAD_TMP_PATH__#$UPLOAD_TMP_PATH#g" \ -e "s/__LOG_DIR__/\/var\/log\/koha\/$name/g" \ -e "s/__PLUGINS_DIR__/\/var\/lib\/koha\/$name\/plugins/g" \ -e "s/__MEMCACHED_NAMESPACE__/$MEMCACHED_NAMESPACE/g" \ @@ -329,6 +332,17 @@ set_upload_path() fi } +set_upload_tmp_path() +{ + local instance="$1" + + if [ "$CLO_UPLOAD_TMP_PATH" != "" ]; then + UPLOAD_TMP_PATH=$CLO_UPLOAD_TMP_PATH + else + UPLOAD_TMP_PATH="$UPLOAD_PATH_BASE/$instance/$UPLOAD_TMP_DIR" + fi +} + enable_sru_server() { # remove the commenting symbols @@ -417,6 +431,9 @@ UPLOAD_DIR="uploads" UPLOAD_PATH="" # timezone defaults to empty TIMEZONE="" +# hardcoded upload_tmp_path +UPLOAD_TMP_DIR="uploads_tmp" +UPLOAD_TMP_PATH="" # cache base dir CACHE_DIR_BASE="/var/cache/koha" # Generate a randomizaed API secret @@ -463,6 +480,7 @@ CLO_AUTHORITIES_INDEXING_MODE="" CLO_MEMCACHED_SERVERS="" CLO_MEMCACHED_PREFIX="" CLO_UPLOAD_PATH="" +CLO_UPLOAD_TMP_PATH="" CLO_LETSENCRYPT="" CLO_TEMPLATE_CACHE_DIR="" CLO_TIMEZONE="" @@ -511,6 +529,8 @@ while true ; do CLO_TIMEZONE="$2" ; shift 2 ;; --upload-path) CLO_UPLOAD_PATH="$2" ; shift 2 ;; + --upload-tmp-path) + CLO_UPLOAD_TMP_PATH="$2" ; shift 2 ;; --letsencrypt) CLO_LETSENCRYPT="yes" ; shift ;; -h|--help) @@ -580,6 +600,7 @@ set_authorities_indexing_mode $AUTHORITIES_INDEXING_MODE $ZEBRA_MARC_FORMAT name="$1" set_upload_path $name +set_upload_tmp_path $name if [ "$op" = use ] && [ "$CLO_DATABASE" = "" ] && ( [ ! -f "$PASSWDFILE" ] || [ ! `cat $PASSWDFILE | grep "^$name:"` ] ) diff --git a/debian/scripts/koha-create-dirs b/debian/scripts/koha-create-dirs index 6d47c157bc..f7777dffb5 100755 --- a/debian/scripts/koha-create-dirs +++ b/debian/scripts/koha-create-dirs @@ -55,6 +55,7 @@ do userdir "$name" "/var/lib/koha/$name/biblios/tmp" userdir "$name" "/var/lib/koha/$name/plugins" userdir "$name" "/var/lib/koha/$name/uploads" + userdir "$name" "/var/lib/koha/$name/uploads_tmp" userdir "$name" "/var/lock/koha/$name" userdir "$name" "/var/lock/koha/$name/authorities" userdir "$name" "/var/lock/koha/$name/biblios" diff --git a/debian/templates/koha-conf-site.xml.in b/debian/templates/koha-conf-site.xml.in index 6d3d31eda2..7d91711bb8 100644 --- a/debian/templates/koha-conf-site.xml.in +++ b/debian/templates/koha-conf-site.xml.in @@ -261,6 +261,7 @@ __END_SRU_PUBLICSERVER__ __PLUGINS_DIR__ 0 __UPLOAD_PATH__ + __UPLOAD_TMP_PATH__ /usr/share/koha/intranet/cgi-bin /usr/share/koha/opac/cgi-bin/opac /usr/share/koha/opac/htdocs/opac-tmpl diff --git a/etc/koha-conf.xml b/etc/koha-conf.xml index 1b50f77a45..111c40fa26 100644 --- a/etc/koha-conf.xml +++ b/etc/koha-conf.xml @@ -93,6 +93,7 @@ __PAZPAR2_TOGGLE_XML_POST__ __PLUGINS_DIR__ 0 + __INTRANET_CGI_DIR__ __OPAC_CGI_DIR__/opac __OPAC_TMPL_DIR__ -- 2.39.5