Bugzilla – Attachment 62443 Details for
Bug 17951
koha-create should create the template cache dir and configure it in koha-conf.xml
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17951: Make koha-create set template_cache_dir correctly
Bug-17951-Make-koha-create-set-templatecachedir-co.patch (text/plain), 8.97 KB, created by
Marcel de Rooy
on 2017-04-20 06:45:54 UTC
(
hide
)
Description:
Bug 17951: Make koha-create set template_cache_dir correctly
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-04-20 06:45:54 UTC
Size:
8.97 KB
patch
obsolete
>From 2df330174a10fb3296f6ece0c46356947ecbd39d Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 24 Jan 2017 12:48:18 -0300 >Subject: [PATCH] Bug 17951: Make koha-create set template_cache_dir correctly >Content-Type: text/plain; charset=utf-8 > >This patch makes koha-create (and friends) handle the template_cache_dir >config entry correctly. > >It does so by: >- Adding a replaceable string to the template for koha-conf.xml >- Making koha-create-dirs create the needed directories (i.e. > /var/cache/koha/instance and /var/cache/koha/instance/templates) >- Adding a --template-cache-dir switch to koha-create (so sysadmins can > specify their favourite directory for the templates cache). >- koha-remove now takes care of the instance's *templates* dir. >- The install scripts now automatically create /var/cache/koha so it can > be used later by koha-create and friends. It does so the same way it does > for other install-created directories. > >To test, you should ideally be able to build your own packages. This >instructions can be followed by people that doesn't have that ability >yet. But can be used on a custom packages setup too. > >To test: >- Make sure you have the latest misc4dev in your kohadevbox (if it is a > fresh box you have it already) >- Run: > $ sudo perl misc4dev/cp_debian_files.pl >- Manually create the /var/cache/koha dir (skip if you have your own > packages): > $ sudo mkdir /var/cache/koha >- Create a new instance: > $ sudo koha-create --create-db cachetest >=> SUCCESS: > * /etc/koha/sites/cachetest/koha-conf.xml contains > template_cache_dir and is populated with /var/cache/koha/cachetest/templates > * The directory /var/cache/koha/cachetest/templates exists! >- Create a new instance, pass your own cache dir: > $ sudo koha-create --create-db --template-cache-dir /tmp cachetest2 >=> SUCCESS: etc/koha/sites/cachetest2/koha-conf.xml contains template_cache_dir > and is populated with /tmp >- Run: > $ man koha-create >=> SUCCESS: The docs mention the --template-cache-dir option switch > correctly. >- Sign off :-D! > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > debian/docs/koha-create.xml | 9 +++++++++ > debian/koha-common.dirs | 1 + > debian/scripts/koha-create | 18 ++++++++++++++++-- > debian/scripts/koha-create-dirs | 2 ++ > debian/scripts/koha-remove | 2 ++ > debian/templates/koha-conf-site.xml.in | 5 +---- > 6 files changed, 31 insertions(+), 6 deletions(-) > >diff --git a/debian/docs/koha-create.xml b/debian/docs/koha-create.xml >index aad649a..a70edee 100644 >--- a/debian/docs/koha-create.xml >+++ b/debian/docs/koha-create.xml >@@ -39,6 +39,7 @@ > <arg><option>--adminuser</option> n</arg> > <arg><option>--enable-sru</option></arg> > <arg><option>--sru-port</option> port</arg> >+ <arg><option>--template-cache-dir</option> directory</arg> > <arg><option>--upload-path</option> directory</arg> > <arg><option>--letsencrypt</option></arg> > <arg><option>--help</option>|<option>-h</option></arg> >@@ -177,6 +178,14 @@ > </varlistentry> > > <varlistentry> >+ <term><option>--template-cache-dir</option></term> >+ <listitem> >+ <para>Specify a <option>directory</option> for storing the template cache files of the instance. >+ It defaults to <filename>/var/cache/koha/instance/templates</filename>.</para> >+ </listitem> >+ </varlistentry> >+ >+ <varlistentry> > <term><option>--upload-path</option></term> > <listitem> > <para>Specify a <option>directory</option> for storing the permanently uploaded files of the instance. >diff --git a/debian/koha-common.dirs b/debian/koha-common.dirs >index 93a6041..b98541d 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 b21e472..fbaf992 100755 >--- a/debian/scripts/koha-create >+++ b/debian/scripts/koha-create >@@ -69,6 +69,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/<instance>/templates > --upload-path dir Set a user defined upload_path. It defaults to > /var/lib/koha/<instance>/uploads > --letsencrypt Set up a https-only site with letsencrypt certificates >@@ -112,6 +114,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" \ >@@ -404,6 +407,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 >@@ -432,7 +437,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:,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:,database:,adminuser:,memcached-servers:,memcached-prefix:,template-cache-dir:,upload-path:,letsencrypt, \ > -n "$0" -- "$@"` > > # Note the quotes around `$TEMP': they are essential! >@@ -449,6 +454,7 @@ CLO_MEMCACHED_SERVERS="" > CLO_MEMCACHED_PREFIX="" > CLO_UPLOAD_PATH="" > CLO_LETSENCRYPT="" >+CLO_TEMPLATE_CACHE_DIR="" > > while true ; do > case "$1" in >@@ -488,6 +494,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) >@@ -574,6 +582,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 ]] >@@ -709,7 +724,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 dae0d48..6d47c15 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 763da29..0684780 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 2add4aa..7cdd81c 100644 >--- a/debian/templates/koha-conf-site.xml.in >+++ b/debian/templates/koha-conf-site.xml.in >@@ -291,10 +291,7 @@ __END_SRU_PUBLICSERVER__ > <!-- <zebra_loglevels>none,fatal,warn</zebra_loglevels> --> > <memcached_servers>__MEMCACHED_SERVERS__</memcached_servers> > <memcached_namespace>__MEMCACHED_NAMESPACE__</memcached_namespace> >- <!-- Uncomment the following line if you want to use template caching >- That will bring a performance boost >- <template_cache_dir>/tmp</template_cache_dir> >- --> >+ <template_cache_dir>__TEMPLATE_CACHE_DIR__</template_cache_dir> > > <!-- Secret passphrase used by Mojolicious for signed cookies --> > <api_secret_passphrase>__API_SECRET__</api_secret_passphrase> >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17951
:
59512
|
62443
|
62690
|
68163
|
68164
|
70066
|
70067