Lines 60-79
do
Link Here
|
60 |
fi |
60 |
fi |
61 |
|
61 |
|
62 |
echo "Removing Koha instance $name" |
62 |
echo "Removing Koha instance $name" |
63 |
mysql_hostname="localhost" |
63 |
REQUEST_DB=0 #we've always assumed that we have rights to do things with the database. Just carrying that forward. |
64 |
if [ "$keepmysql" != "1" ] |
64 |
if [ -e /etc/koha/sites/$name/createoptions ] ; then |
65 |
then |
65 |
#instances created after version 3.24 will have this file. Older ones will not. |
66 |
# The grant creates the user in case it isn't, we don't want our loop to fail if it has already being deleted. |
66 |
#this checks to see if the database was created with --request-db instead of --create-db, because we can't always delete remote databases. |
67 |
mysql --defaults-extra-file=/etc/mysql/koha-common.cnf <<eof |
67 |
. /etc/koha/sites/$name/createoptions |
68 |
GRANT USAGE ON \`koha_$name\`.* TO \`koha_$name\`@\`%\`; |
68 |
fi |
69 |
GRANT USAGE ON \`koha_$name\`.* TO \`koha_$name\`@\`$mysql_hostname\`; |
69 |
if [ $REQUEST_DB -eq 0 ] ; then |
70 |
DROP USER \`koha_$name\`@\`%\`; |
|
|
71 |
DROP USER \`koha_$name\`@\`$mysql_hostname\`; |
72 |
DROP DATABASE IF EXISTS \`koha_$name\`; |
73 |
FLUSH PRIVILEGES; |
74 |
eof |
75 |
fi #` |
76 |
|
70 |
|
|
|
71 |
echo "Removing local database" |
72 |
mysql_hostname="localhost" |
73 |
if [ "$keepmysql" != "1" ] |
74 |
then |
75 |
# The grant creates the user in case it isn't, we don't want our loop to fail if it has already being deleted. |
76 |
mysql --defaults-extra-file=/etc/mysql/koha-common.cnf <<eof |
77 |
GRANT USAGE ON \`koha_$name\`.* TO \`koha_$name\`@\`%\`; |
78 |
GRANT USAGE ON \`koha_$name\`.* TO \`koha_$name\`@\`$mysql_hostname\`; |
79 |
DROP USER \`koha_$name\`@\`%\`; |
80 |
DROP USER \`koha_$name\`@\`$mysql_hostname\`; |
81 |
DROP DATABASE IF EXISTS \`koha_$name\`; |
82 |
FLUSH PRIVILEGES; |
83 |
eof |
84 |
fi #` |
85 |
else |
86 |
echo "This instance was created with --request-db and may have a remote database. Database not removed." |
87 |
fi |
77 |
# If the daemon is not running already, we don't want to fail this loop. So bin the result code if this fails. |
88 |
# If the daemon is not running already, we don't want to fail this loop. So bin the result code if this fails. |
78 |
koha-stop-zebra $name || /bin/true |
89 |
koha-stop-zebra $name || /bin/true |
79 |
|
90 |
|
80 |
- |
|
|