diff --git a/debian/docs/koha-create.xml b/debian/docs/koha-create.xml index 47b4a002b4..632140d471 100644 --- a/debian/docs/koha-create.xml +++ b/debian/docs/koha-create.xml @@ -40,6 +40,7 @@ n port + directory directory | @@ -184,6 +185,14 @@ + + + + Specify a for storing the template cache files of the instance. + It defaults to /var/cache/koha/instance/templates. + + + diff --git a/debian/koha-common.dirs b/debian/koha-common.dirs index 93a60417cb..b98541d007 100644 --- a/debian/koha-common.dirs +++ b/debian/koha-common.dirs @@ -1,4 +1,5 @@ etc/koha/sites +var/cache/koha var/lib/koha var/log/koha var/lock/koha diff --git a/debian/scripts/koha-create b/debian/scripts/koha-create index 7b6b51297a..aa01f809b7 100755 --- a/debian/scripts/koha-create +++ b/debian/scripts/koha-create @@ -70,6 +70,8 @@ Options: --database dbname Enforce the use of the specified DB name (64 char limit) --adminuser n Explicit the admin user ID in the DB. Relevant in conjunction with --defaultsql and --populate-db. + --template-cache-dir Set a user defined template_cache_dir. It defaults to + /var/cache/koha//templates --upload-path dir Set a user defined upload_path. It defaults to /var/lib/koha//uploads --letsencrypt Set up a https-only site with letsencrypt certificates @@ -113,6 +115,7 @@ generate_config_file() { -e "s/__DB_PASS__/$mysqlpwd/g" \ -e "s/__UNIXUSER__/$username/g" \ -e "s/__UNIXGROUP__/$username/g" \ + -e "s#__TEMPLATE_CACHE_DIR__#$TEMPLATE_CACHE_DIR#g" \ -e "s#__UPLOAD_PATH__#$UPLOAD_PATH#g" \ -e "s/__LOG_DIR__/\/var\/log\/koha\/$name/g" \ -e "s/__PLUGINS_DIR__/\/var\/lib\/koha\/$name\/plugins/g" \ @@ -406,6 +409,8 @@ DEFAULT_MEMCACHED_PREFIX="koha_" UPLOAD_PATH_BASE="/var/lib/koha" UPLOAD_DIR="uploads" UPLOAD_PATH="" +# cache base dir +CACHE_DIR_BASE="/var/cache/koha" # Generate a randomizaed API secret API_SECRET="$(pwgen -s 64 1)" # SRU server variables @@ -434,7 +439,7 @@ fi [ $# -ge 1 ] && [ $# -le 16 ] || ( usage ; die "Error: wrong parameters" ) -TEMP=`getopt -o chrpm:l:d:f:b:a: -l create-db,request-db,populate-db,use-db,use-memcached,enable-sru,sru-port:,help,marcflavor:,auth-idx:,biblio-idx:,zebralang:,defaultsql:,configfile:,passwdfile:,dbhost:,database:,adminuser:,memcached-servers:,memcached-prefix:,upload-path:,letsencrypt, \ +TEMP=`getopt -o chrpm:l:d:f:b:a: -l create-db,request-db,populate-db,use-db,use-memcached,enable-sru,sru-port:,help,marcflavor:,auth-idx:,biblio-idx:,zebralang:,defaultsql:,configfile:,passwdfile:,dbhost:,database:,adminuser:,memcached-servers:,memcached-prefix:,template-cache-dir:,upload-path:,letsencrypt, \ -n "$0" -- "$@"` # Note the quotes around `$TEMP': they are essential! @@ -451,6 +456,7 @@ CLO_MEMCACHED_SERVERS="" CLO_MEMCACHED_PREFIX="" CLO_UPLOAD_PATH="" CLO_LETSENCRYPT="" +CLO_TEMPLATE_CACHE_DIR="" while true ; do case "$1" in @@ -492,6 +498,8 @@ while true ; do ENABLE_SRU="yes" ; shift ;; --sru-port) SRU_SERVER_PORT="$2" ; shift 2 ;; + --template-cache-dir) + CLO_TEMPLATE_CACHE_DIR="$2" ; shift 2 ;; --upload-path) CLO_UPLOAD_PATH="$2" ; shift 2 ;; --letsencrypt) @@ -593,6 +601,13 @@ else MEMCACHED_PREFIX="" fi +# Set template cache dir +if [ "$CLO_TEMPLATE_CACHE_DIR" != "" ]; then + TEMPLATE_CACHE_DIR="$CLO_TEMPLATE_CACHE_DIR" +else + TEMPLATE_CACHE_DIR="$CACHE_DIR_BASE/$name/templates" +fi + # Are we root? If not, the mod_rewrite check will fail and be confusing, so # we look into this first. if [[ $UID -ne 0 ]] @@ -728,7 +743,6 @@ eof generate_config_file zebra.passwd.in \ "/etc/koha/sites/$name/zebra.passwd" - # Create a GPG-encrypted file for requesting a DB to be set up. if [ "$op" = request ] then diff --git a/debian/scripts/koha-create-dirs b/debian/scripts/koha-create-dirs index dae0d48d68..6d47c157bc 100755 --- a/debian/scripts/koha-create-dirs +++ b/debian/scripts/koha-create-dirs @@ -40,6 +40,8 @@ for name in "$@" do rootdir "/var/spool/koha/$name" userdir "$name" "/etc/koha/sites/$name" + userdir "$name" "/var/cache/koha/$name" + userdir "$name" "/var/cache/koha/$name/templates" userdir "$name" "/var/lib/koha/$name" userdir "$name" "/var/lib/koha/$name/authorities" userdir "$name" "/var/lib/koha/$name/authorities/key" diff --git a/debian/scripts/koha-remove b/debian/scripts/koha-remove index 763da29ae5..06847808fa 100755 --- a/debian/scripts/koha-remove +++ b/debian/scripts/koha-remove @@ -125,6 +125,8 @@ eof rm -r "/var/lock/koha/$name" [ -d "/var/log/koha/$name" ] && \ rm -r "/var/log/koha/$name" + [ -d "/var/cache/koha/$name" ] && \ + rm -r "/var/cache/koha/$name" [ -d "/var/run/koha/$name" ] && \ rm -r "/var/run/koha/$name" [ "$purgeall" = "1" ] && [ -d "/var/lib/koha/$name" ] && \ diff --git a/debian/templates/koha-conf-site.xml.in b/debian/templates/koha-conf-site.xml.in index a8152a9cc7..85b54a9ec5 100644 --- a/debian/templates/koha-conf-site.xml.in +++ b/debian/templates/koha-conf-site.xml.in @@ -291,10 +291,7 @@ __END_SRU_PUBLICSERVER__ __MEMCACHED_SERVERS__ __MEMCACHED_NAMESPACE__ - + __TEMPLATE_CACHE_DIR__ __API_SECRET__