|
Lines 52-71
do
Link Here
|
| 52 |
fi |
52 |
fi |
| 53 |
|
53 |
|
| 54 |
echo "Removing Koha instance $name" |
54 |
echo "Removing Koha instance $name" |
| 55 |
|
55 |
mysql_hostname="localhost" |
| 56 |
if [ "$keepmysql" != "1" ] |
56 |
if [ "$keepmysql" != "1" ] |
| 57 |
then |
57 |
then |
| 58 |
# The grant creates the user in case it isn't, we don't want our loop to fail if it has already being deleted. |
58 |
# The grant creates the user in case it isn't, we don't want our loop to fail if it has already being deleted. |
| 59 |
mysql --defaults-extra-file=/etc/mysql/koha-common.cnf <<eof |
59 |
mysql --defaults-extra-file=/etc/mysql/koha-common.cnf <<eof |
| 60 |
GRANT USAGE ON \`koha_$name\`.* TO \`koha_$name\`@\`%\`; |
60 |
GRANT USAGE ON \`koha_$name\`.* TO \`koha_$name\`@\`%\`; |
| 61 |
DROP USER \`koha_$name\`; |
61 |
GRANT USAGE ON \`koha_$name\`.* TO \`koha_$name\`@\`$mysql_hostname\`; |
|
|
62 |
DROP USER \`koha_$name\`@\`%\`; |
| 63 |
DROP USER \`koha_$name\`@\`$mysql_hostname\`; |
| 62 |
DROP DATABASE IF EXISTS \`koha_$name\`; |
64 |
DROP DATABASE IF EXISTS \`koha_$name\`; |
| 63 |
FLUSH PRIVILEGES; |
65 |
FLUSH PRIVILEGES; |
| 64 |
eof |
66 |
eof |
| 65 |
fi #` |
67 |
fi #` |
| 66 |
|
68 |
|
| 67 |
# If the daemon is not running already, we don't want to fail this loop. So bin the result code if this fails. |
69 |
# If the daemon is not running already, we don't want to fail this loop. So bin the result code if this fails. |
| 68 |
koha-stop-zebra $name | /bin/true |
70 |
koha-stop-zebra $name || /bin/true |
| 69 |
[ -f "/etc/apache2/sites-available/$name" ] && \ |
71 |
[ -f "/etc/apache2/sites-available/$name" ] && \ |
| 70 |
rm "/etc/apache2/sites-available/$name" |
72 |
rm "/etc/apache2/sites-available/$name" |
| 71 |
[ -f "/etc/koha/sites/$name/koha-conf.xml" ] && \ |
73 |
[ -f "/etc/koha/sites/$name/koha-conf.xml" ] && \ |
|
Lines 89-95
eof
Link Here
|
| 89 |
rm -r "/var/run/koha/$name" |
91 |
rm -r "/var/run/koha/$name" |
| 90 |
getent passwd "$name-koha" > /dev/null && deluser --quiet "$name-koha" |
92 |
getent passwd "$name-koha" > /dev/null && deluser --quiet "$name-koha" |
| 91 |
# in case the site has already been disabled, we don't want to break the loop now. |
93 |
# in case the site has already been disabled, we don't want to break the loop now. |
| 92 |
a2dissite "$name" | /bin/true |
94 |
a2dissite "$name" || /bin/true |
| 93 |
done |
95 |
done |
| 94 |
|
96 |
|
| 95 |
service apache2 restart |
97 |
service apache2 restart |
| 96 |
- |
|
|