3 # koha-functions.sh -- shared library of helper functions for koha-* scripts
4 # Copyright 2014 - Tomas Cohen Arazi
5 # Universidad Nacional de Cordoba
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
32 get_apache_config_for()
35 local sitefile="/etc/apache2/sites-available/$site"
37 if is_instance $site; then
38 if [ -f "$sitefile.conf" ]; then
40 elif [ -f "$sitefile" ]; then
49 local instancefile=$(get_apache_config_for $site)
51 if [ "$instancefile" = "" ]; then
55 if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \
56 "$instancefile" ; then
67 if find /etc/koha/sites -mindepth 1 -maxdepth 1 \
68 -type d -printf '%f\n'\
69 | grep -q -x "$instancename" ; then
80 if [ -e /var/lib/koha/$instancename/email.enabled ]; then
87 is_letsencrypt_enabled()
91 if [ -e /var/lib/koha/$instancename/letsencrypt.enabled ]; then
100 local instancename=$1
102 if [ -e /etc/koha/sites/$instancename/SIPconfig.xml ]; then
111 local instancename=$1
113 if daemon --name="$instancename-koha-zebra" \
114 --pidfiles="/var/run/koha/$instancename/" \
115 --user="$instancename-koha.$instancename-koha" \
125 local instancename=$1
127 if daemon --name="$instancename-koha-indexer" \
128 --pidfiles="/var/run/koha/$instancename/" \
129 --user="$instancename-koha.$instancename-koha" \
140 local instancefile=$(get_apache_config_for $site)
142 if [ "$instancefile" = "" ]; then
146 if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-opac-plack.conf' \
148 grep -q '^[[:space:]]*Include /etc/koha/apache-shared-intranet-plack.conf' \
149 "$instancefile" ; then
158 local instancename=$1
160 if start-stop-daemon --pidfile "/var/run/koha/${instancename}/plack.pid" \
170 find /etc/koha/sites -mindepth 1 -maxdepth 1\
171 -type d -printf '%f\n' | sort
176 local instancename=$1
177 local retval=$(xmlstarlet sel -t -v 'yazgfs/config/zebra_loglevels' /etc/koha/sites/$instancename/koha-conf.xml)
178 if [ "$retval" != "" ]; then
181 echo "none,fatal,warn"