Bug 17265 - Make koha-create-defaults less greedy
authorMagnus Enger <magnus@libriotech.no>
Thu, 8 Sep 2016 12:13:46 +0000 (14:13 +0200)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 13 Jan 2017 11:33:11 +0000 (11:33 +0000)
commitae8223e333201d264b19bf6ed9e91c10c94349ad
treea43d807ce5eb6d572692851969a375362e4ee145
parent5a08969a71dc27562a1a22af809673a8727f5c82
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>
debian/scripts/koha-create
debian/scripts/koha-dump-defaults