From 27cc011bf9a0034498d6d11db89960cdea742fbc Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 15 Aug 2013 10:17:29 -0300 Subject: [PATCH] Bug 10733: Follow-up - use koha-sites.conf In order to respect the current schema, where configuration values are pondered like this: hardcoded < koha-sites.conf < koha-create option switches I changed the patch a bit. I even changed MEMCACHED_NAMESPACE for MEMCACHED_PREFIX that seems to fit better in the current schema. Any feedback is welcome. Regards To+ Sponsored-by: Universidad Nacional de Cordoba --- debian/docs/koha-create.xml | 28 +++++++++++++++++++++++++--- debian/scripts/koha-create | 32 ++++++++++++++++++++++---------- 2 files changed, 47 insertions(+), 13 deletions(-) diff --git a/debian/docs/koha-create.xml b/debian/docs/koha-create.xml index 0781fd3..61cf588 100644 --- a/debian/docs/koha-create.xml +++ b/debian/docs/koha-create.xml @@ -31,7 +31,7 @@ dom|grs1 server:port - koha_namespace + namespace_prefix /path/to/some.sql /path/to/config /path/to/passwd @@ -143,9 +143,9 @@ - + - Specifiy a memcached for the created Koha instance. You usually leave this option alone to avoid namespace collisions. It defaults to . + Specifiy a for memcached. You usually leave this option alone to avoid namespace collisions. It defaults to . @@ -219,6 +219,28 @@ + + + Valid values are and . If not present koha-create will default to . Also, this will be overriden by the switch. + + + + + + + A comma-separated list of valid memcached servers. Usually in the form of . If not present koha-create will default to . Also, this will be overriden by the arguments of the switch. + + + + + + + A prefix for all new Koha instances to use in memcached. If not present koha-create will default to . Also, this will be overriden by the arguments of the switch. + + + + + Specifies format of MARC records to be indexed by Zebra. Possible values are 'marc21', 'normarc' and 'unimarc'. diff --git a/debian/scripts/koha-create b/debian/scripts/koha-create index bcfadc9..d655ca2 100755 --- a/debian/scripts/koha-create +++ b/debian/scripts/koha-create @@ -23,6 +23,8 @@ usage="Usage: $0 [--create-db|--request-db|--populate-db|--use-db] \ [--marcflavor marc21|normarc|unimarc] \ [--zebralang en|es|fr|nb|ru|uk] \ [--auth-idx dom|grs1] [--biblio-idx dom|grs1] \ + [--use-memcached] \ + [--memcached-servers server:port] [--memcached-prefix prefix] \ [--defaultsql /path/to/some.sql] \ [--configfile /path/to/config] [--passwdfile /path/to/passwd] \ [--database database] [--adminuser n] instancename" @@ -164,14 +166,20 @@ set_memcached() if [ "$CLO_MEMCACHED_SERVERS" != "" ]; then MEMCACHED_SERVERS=$CLO_MEMCACHED_SERVERS else - MEMCACHED_SERVERS=$DEFAULT_MEMCACHED_SERVERS + if [ "$MEMCACHED_SERVERS" = "" ]; then + MEMCACHED_SERVERS=$DEFAULT_MEMCACHED_SERVERS + # else: was set by the koha-sites.conf file + fi fi - if [ "$CLO_MEMCACHED_NAMESPACE" != "" ]; then - MEMCACHED_NAMESPACE=$CLO_MEMCACHED_NAMESPACE + if [ "$CLO_MEMCACHED_PREFIX" != "" ]; then + MEMCACHED_NAMESPACE="$CLO_MEMCACHED_PREFIX"_"$instance" else - # default - MEMCACHED_NAMESPACE="koha_$instance" + if [ "$MEMCACHED_PREFIX" != "" ]; then + MEMCACHED_NAMESPACE="$MEMCACHED_PREFIX"_"$instance" + else + MEMCACHED_NAMESPACE="$DEFAULT_MEMCACHED_PREFIX"_"$instance" + fi fi } @@ -189,10 +197,14 @@ ZEBRA_MARC_FORMAT="marc21" ZEBRA_LANGUAGE="en" ADMINUSER="1" PASSWDFILE="/etc/koha/passwd" + +# memcached variables USE_MEMCACHED="no" MEMCACHED_SERVERS="" -MEMCACHED_NAMESPACE="" +MEMCACHED_PREFIX="" +# hardcoded memcached defaults DEFAULT_MEMCACHED_SERVERS="127.0.0.1:11211" +DEFAULT_MEMCACHED_PREFIX="koha_" # Indexing mode variables (default is DOM) BIBLIOS_INDEXING_MODE="dom" @@ -210,7 +222,7 @@ fi [ $# -ge 2 ] && [ $# -le 16 ] || die $usage -TEMP=`getopt -o crpm:l:d:f:b:a: -l create-db,request-db,populate-db,use-db,use-memcached,marcflavor:,auth-idx:,biblio-idx:,zebralang:,defaultsql:,configfile:,passwdfile:,database:,adminuser:,memcached-servers:,memcached-namespace:, \ +TEMP=`getopt -o crpm:l:d:f:b:a: -l create-db,request-db,populate-db,use-db,use-memcached,marcflavor:,auth-idx:,biblio-idx:,zebralang:,defaultsql:,configfile:,passwdfile:,database:,adminuser:,memcached-servers:,memcached-prefix:, \ -n "$0" -- "$@"` # Note the quotes around `$TEMP': they are essential! @@ -224,7 +236,7 @@ CLO_ADMINUSER="" CLO_BIBLIOS_INDEXING_MODE="" CLO_AUTHORITIES_INDEXING_MODE="" CLO_MEMCACHED_SERVERS="" -CLO_MEMCACHED_NAMESPACE="" +CLO_MEMCACHED_PREFIX="" while true ; do @@ -239,8 +251,8 @@ while true ; do --memcached-servers) CLO_MEMCACHED_SERVERS="$2" shift 2 ;; - --memcached-namespace) - CLO_MEMCACHED_NAMESPACE="$2" + --memcached-prefix) + CLO_MEMCACHED_PREFIX="$2" shift 2;; -m|--marcflavor) CLO_ZEBRA_MARC_FORMAT="$2" ; shift 2 ;; -l|--zebralang) CLO_ZEBRA_LANGUAGE="$2" ; shift 2 ;; -- 1.8.1.2