Bug 23346: Add without-db-name parameter to koha-dump

Test plan:
Run koha-dump [yourdb]. Rename the files in var/spool/koha/[yourdb]
Run koha-dump --without-db-name [yourdb]
Run a diff between the unzipped sql files. The last dump should not
contain a CREATE DATABASE and USE statement. See BZ 15664 c4.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Marcel de Rooy 2019-07-19 10:24:01 +00:00 committed by Martin Renvoize
parent 6d8a26e575
commit d7d5a40548
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
1 changed files with 8 additions and 1 deletions

View File

@ -47,6 +47,7 @@ $scriptname -h|--help
--quiet|-q Make the script avoid printing to STDOUT
(useful for calling from another scripts).
--help|-h Display this help message
--without-db-name Do not include database name
EOF
}
@ -69,7 +70,9 @@ dump_instance()
[ -z "$backupdir" ] && backupdir="/var/spool/koha/$name"
dbdump="$backupdir/$name-$date.sql.gz"
[ "$quiet" = "no" ] && echo "* DB to $dbdump"
mysqldump --databases --host="$mysqlhost" \
dbflag="--databases"
[ "$without_db_name" = "yes" ] && dbflag=""
mysqldump $dbflag --host="$mysqlhost" \
--user="$mysqluser" --password="$mysqlpass" "$mysqldb" |
gzip > "$dbdump"
chown "root:$name-koha" "$dbdump"
@ -99,6 +102,7 @@ dump_instance()
# Default values
quiet="no"
exclude_indexes="no"
without_db_name="no"
while [ $# -gt 0 ]; do
@ -106,6 +110,9 @@ while [ $# -gt 0 ]; do
--exclude-indexes)
exclude_indexes="yes"
shift ;;
--without-db-name)
without_db_name="yes"
shift ;;
-h|--help)
usage ; exit 0 ;;
-q|--quiet)