Bug 21177: Use koha-conf.xml in misc/devel/update_dbix_class_files.pl
authorJulian Maurice <julian.maurice@biblibre.com>
Wed, 8 Aug 2018 13:40:09 +0000 (15:40 +0200)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 10 Feb 2020 10:12:15 +0000 (10:12 +0000)
commit1bcc2159a5c137c216f6afa759cb7da5f2f4a15d
treefff58b675bab0383b4126b49416d058946cb7f01
parent013edd90e31a871c4125cee3d6f48fd25af40138
Bug 21177: Use koha-conf.xml in misc/devel/update_dbix_class_files.pl

It is annoying to have to specify database connection parameters each
time DBIx::Class files need to be updated.

This patch adds a new option --koha-conf that takes an optional <path>
which defaults to the value of KOHA_CONF environment variable, and use
the database connection parameters found in that file.
--db_* options override values from $KOHA_CONF

Test plan:
1. Run the script with the same parameters as before the patch and see
   that it still works.
   Example:
     misc/devel/update_dbix_class_files.pl --db_name koha_dev \
     --db_user koha --db_pass koha

2. Verify that KOHA_CONF is set and execute:
     misc/devel/update_dbix_class_files.pl --koha-conf
   Verify that Koha/Schema files were updated accordingly

3. Execute:
    misc/devel/update_dbix_class_files.pl --koha-conf \
    /path/to/another/koha-conf.xml
   Verify that Koha/Schema files were updated accordingly

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
misc/devel/update_dbix_class_files.pl