Bugzilla – Attachment 44347 Details for
Bug 15088
Notice when koha has been installed with --request-db instead of --create-db
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15088 - notice when koha has been installed with --request-db instead of --create-db
Bug-15088---notice-when-koha-has-been-installed-wi.patch (text/plain), 4.96 KB, created by
Liz Rea
on 2015-11-03 21:58:20 UTC
(
hide
)
Description:
Bug 15088 - notice when koha has been installed with --request-db instead of --create-db
Filename:
MIME Type:
Creator:
Liz Rea
Created:
2015-11-03 21:58:20 UTC
Size:
4.96 KB
patch
obsolete
>From 315aa3bdde309fe02d51cd75a4e79757daa25aa4 Mon Sep 17 00:00:00 2001 >From: Liz Rea <liz@catalyst.net.nz> >Date: Tue, 3 Nov 2015 16:17:01 +1300 >Subject: [PATCH] Bug 15088 - notice when koha has been installed with > --request-db instead of --create-db > >Patch does 2 major things - > >* creates an options file during koha-create that lets us know what database option was used when the instance was created >/etc/koha/sites/$name/createoptions >* when an instance is removed, we assume we can do things to the database, per usual. If we have a createoptions, we'll read it and find out if our instance was created with create-db or request-db. >If it was requested, we don't do anything with the database because we assume we don't have rights to, and print a message. >If it was created, we do the same thing we've always done - remove the database and users (unless we've specified --keep-mysql) > >To test: > >create a throwaway instance with --create-db >remove that instance, all should happen as normal. >your instance should have an /etc/koha/sites/$name/createoptions file with REQUEST_DB=0 in it. > >create another throwaway instance with --request-db >remove that instance, you should see a message alerting you to the fact that you may still have database work to do after Koha is removed. >your instance should have an /etc/koha/sites/$name/createoptions file with REQUEST_DB=1 in it. >--- > debian/scripts/koha-create | 15 +++++++++++++++ > debian/scripts/koha-remove | 37 ++++++++++++++++++++++++------------- > 2 files changed, 39 insertions(+), 13 deletions(-) > >diff --git a/debian/scripts/koha-create b/debian/scripts/koha-create >index a36f7e3..ef6891f 100755 >--- a/debian/scripts/koha-create >+++ b/debian/scripts/koha-create >@@ -575,6 +575,9 @@ then > zebrapwd="$(pwgen -s 16 1)" > # Future enhancement: make this configurable for when your db is on > # another server. >+ touch "/etc/koha/sites/$name/createoptions" >+ chown "$username:$username" "/etc/koha/sites/$name/createoptions" >+ > mysql_hostname="localhost" > # Set up MySQL database for this instance. > if [ "$op" = create ] >@@ -641,6 +644,11 @@ database user: $mysqluser > Thank you. > eof > >+ cat > "/etc/koha/sites/$name/createoptions" << eof >+# do not edit this file, it is for record keeping purposes only >+REQUEST_DB=1 >+eof >+ > echo "See $name-db-request.txt for database creation request." > echo "Please forward it to the right person, and then run" > echo "$0 --populate-db $name" >@@ -678,6 +686,13 @@ UPDATE borrowers > SET password = '$staffdigest' > WHERE borrowernumber = $ADMINUSER; > eof >+ >+ cat > "/etc/koha/sites/$name/createoptions" << eof >+# do not edit this file, it is for record keeping purposes only >+REQUEST_DB=0 >+eof >+ >+ > #` > echo "staff user password is '$staffpass' but keep that secret" > >diff --git a/debian/scripts/koha-remove b/debian/scripts/koha-remove >index 528db75..6916242 100755 >--- a/debian/scripts/koha-remove >+++ b/debian/scripts/koha-remove >@@ -60,20 +60,31 @@ do > fi > > echo "Removing Koha instance $name" >- mysql_hostname="localhost" >- if [ "$keepmysql" != "1" ] >- then >- # The grant creates the user in case it isn't, we don't want our loop to fail if it has already being deleted. >- mysql --defaults-extra-file=/etc/mysql/koha-common.cnf <<eof >-GRANT USAGE ON \`koha_$name\`.* TO \`koha_$name\`@\`%\`; >-GRANT USAGE ON \`koha_$name\`.* TO \`koha_$name\`@\`$mysql_hostname\`; >-DROP USER \`koha_$name\`@\`%\`; >-DROP USER \`koha_$name\`@\`$mysql_hostname\`; >-DROP DATABASE IF EXISTS \`koha_$name\`; >-FLUSH PRIVILEGES; >-eof >- fi #` >+ REQUEST_DB=0 #we've always assumed that we have rights to do things with the database. Just carrying that forward. >+ if [ -e /etc/koha/sites/$name/createoptions ] ; then >+ #instances created after version 3.24 will have this file. Older ones will not. >+ #this checks to see if the database was created with --request-db instead of --create-db, because we can't always delete remote databases. >+ . /etc/koha/sites/$name/createoptions >+ fi >+ if [ $REQUEST_DB -eq 0 ] ; then > >+ echo "Removing local database" >+ mysql_hostname="localhost" >+ if [ "$keepmysql" != "1" ] >+ then >+ # The grant creates the user in case it isn't, we don't want our loop to fail if it has already being deleted. >+ mysql --defaults-extra-file=/etc/mysql/koha-common.cnf <<eof >+ GRANT USAGE ON \`koha_$name\`.* TO \`koha_$name\`@\`%\`; >+ GRANT USAGE ON \`koha_$name\`.* TO \`koha_$name\`@\`$mysql_hostname\`; >+ DROP USER \`koha_$name\`@\`%\`; >+ DROP USER \`koha_$name\`@\`$mysql_hostname\`; >+ DROP DATABASE IF EXISTS \`koha_$name\`; >+ FLUSH PRIVILEGES; >+eof >+ fi #` >+ else >+ echo "This instance was created with --request-db and may have a remote database. Database not removed." >+ fi > # If the daemon is not running already, we don't want to fail this loop. So bin the result code if this fails. > koha-stop-zebra $name || /bin/true > >-- >1.9.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15088
:
44347
|
48184
|
48186
|
48187
|
52004