Bug 17265 - Make koha-create-defaults less greedy
koha-create-defaults substitutes the instance name with the placeholder __KOHASITE__ in the SQL file that it creates. If the instance name is something common, like "data", this means that way too many substitutions will be made, and when koha-create uses the SQL file as a template, broken data can be the result. The solution in this patch was suggested by drojf on IRC. To test: - Create an instance called "data" - Run "sudo koha-dump-defaults data > test.sql" - Take a look at test.sql and verify there are way too many occurences of __KOHASITE__, like "-- Dumping __KOHASITE__ for table `accountlines`" - Apply the patch - Copy the resulting koha-create and koha-dump-defaults to somewhere running off the packages - Run "sudo koha-dump-defaults data > test.sql" again and verify there are only 4 occurrences of __KOHASITE__, in places that make sense - Create an instance with something like: $ gzip test.sql $ sudo koha-create --create-db --defaultsql test.sql.gz test17265 - Verify that you have a working Koha install Signed-off-by: Andreas Roussos <arouss1980@gmail.com> Works as expected. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
5a08969a71
commit
ae8223e333
2 changed files with 2 additions and 2 deletions
2
debian/scripts/koha-create
vendored
2
debian/scripts/koha-create
vendored
|
@ -745,7 +745,7 @@ then
|
|||
then
|
||||
# Populate the database with default content.
|
||||
zcat "$DEFAULTSQL" |
|
||||
sed "s/__KOHASITE__/$name/g" |
|
||||
sed "s/__KOHASITE__/koha_$name/g" |
|
||||
mysql --host="$mysqlhost" --user="$mysqluser" --password="$mysqlpwd" "$mysqldb"
|
||||
|
||||
|
||||
|
|
2
debian/scripts/koha-dump-defaults
vendored
2
debian/scripts/koha-dump-defaults
vendored
|
@ -33,4 +33,4 @@ mysqluser="$( xmlstarlet sel -t -v 'yazgfs/config/user' $kohaconfig )"
|
|||
mysqlpass="$( xmlstarlet sel -t -v 'yazgfs/config/pass' $kohaconfig )"
|
||||
mysqldump --databases --host="$mysqlhost" --user="$mysqluser" \
|
||||
--password="$mysqlpass" "$mysqldb" |
|
||||
sed "s/$name/__KOHASITE__/g"
|
||||
sed "s/koha_$name/__KOHASITE__/g"
|
||||
|
|
Loading…
Reference in a new issue