Bug 9998: new tool to import/export and compare system preferences
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Wed, 8 May 2013 14:29:23 +0000 (16:29 +0200)
committerGalen Charlton <gmc@esilibrary.com>
Tue, 2 Jul 2013 14:08:05 +0000 (07:08 -0700)
commitaa4fde7d0d6dee14e3715f3063f16ee4f623b936
tree66e23e502968d3880ed46d4a1d2a8e08448215a5
parent1a1658f020e482abdd35fc8afc04cfcbce91e046
Bug 9998: new tool to import/export and compare system preferences

This patch adds a new maintenance script: cmp_sysprefs.pl

Test plan:
1 Run with -cmd backup -file zz01. Check that file.
  Run with -cmd test -file zz01. Check zz01.sav.
2 Run with -cmd compare -file zz01. No differences expected.
3 Edit zz01: delete two prefs, change two prefs and add two new prefs.
4 Run with -cmd compare -file zz01. Are all six changes reported?
5 Add local use preference zz02 in the staff client (no explanation, options).
6 Run with -cmd backup -file zz02.
7 Delete local use pref zz02 from the staff client.
8 Run with -cmd restore -file zz02. Check if local pref zz02 came back.
9 Delete local use pref zz02 again from the staff client.
10 Run with -cmd compare -file zz02 -add. Check if local pref zz02 came back.
11 Change the value of zz02 in the staff client.
12 Run with -cmd compare -file zz02 -add. Check the value: not updated?
13 Run with -cmd compare -file zz02 -upd. Check the value: updated now?
14 Edit file zz02. Add a comment line and delete the line for pref zz02.
15 Run with -cmd compare -file zz02 -del. Is pref zz02 deleted?
16 Add local use preference zz02 in the staff client (WITH explanation).
17 Run with -cmd compare -file zz02 -del. pref zz02 should not be deleted.
18 Run with -cmd compare -file zz02 -del -ign-opt. zz02 should be deleted now.

Do the next steps only on a restorable test db:
19 Create file zz03. Leave it empty.
   Compare with: -cmd compare -file zz03 -del -ign-opt.
   All prefs gone except Version?
20 Restore with: -cmd restore -file zz01.sav.
   Compare with -cmd compare -file zz01.sav. Nothing reported?
   Note: The explanation or options are not recovered. (See also BZ 10199.)
   This affects local use preferences only.
   If you need them, restore your test db. Remove the zz files.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Amended patch
Only cosmetic stuff:
Perltidied with xt/perltidyrc.
Replaced most double quotes by single quotes around SQL statements.
Moved the usage into POD for pod2usage.
Passing no file shows help screen too.
Counting the db updates more accurately with return value of do.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
misc/maintenance/cmp_sysprefs.pl [new file with mode: 0755]