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