[Bug 9998] New: Backup, compare or restore system preferences (from file)
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9998 Bug ID: 9998 Summary: Backup, compare or restore system preferences (from file) Classification: Unclassified Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: new feature Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: gmcharlt@gmail.com Reporter: m.de.rooy@rijksmuseum.nl Would be useful if we could compare preferences between Koha instances or in time, and optionally restore them to some point. Will soon submit an admin script for this purpose. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9998 M. de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9998 M. de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9998 M. de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |gmcharlt@gmail.com Component|Architecture, internals, |System Administration |and plumbing | Assignee|gmcharlt@gmail.com |koha-bugs@lists.koha-commun | |ity.org -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9998 M. de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |m.de.rooy@rijksmuseum.nl |ity.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9998 M. de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Backup, compare or restore |Import/export and compare |system preferences (from |system preferences |file) | -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9998 --- Comment #1 from M. de Rooy <m.de.rooy@rijksmuseum.nl> --- # Two interesting features are: # 1) It may help you to compare systempreferences between Koha instances. # 2) You can also quickly restore subsets of preferences while testing. # Just leave only e.g. some circulations prefs in a file and compare with # the update flag. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9998 M. de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9998 --- Comment #2 from M. de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 18029 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=18029&action=edit Bug 9998: 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. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9998 M. de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |http://bugs.koha-community. | |org/bugzilla3/show_bug.cgi? | |id=10199 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9998 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9998 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #18029|0 |1 is obsolete| | --- Comment #3 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 19006 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=19006&action=edit Bug 9998: 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> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9998 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@biblibre.co | |m --- Comment #4 from Jonathan Druart <jonathan.druart@biblibre.com> --- QA comment: Note: I did not test the feature! 1/ It would be good to use perltidy on this new file. 2/ Don't you think it is better to have a pod instead of the "print <<_USAGE_" stuff (and to use Pod2Usage)? 3/ SQL strings should be between simple quotes. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9998 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA --- Comment #5 from Jonathan Druart <jonathan.druart@biblibre.com> --- Marked as Failed QA. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9998 --- Comment #6 from M. de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 19055 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=19055&action=edit Bug 9998: QA Followup for comparing sysprefs Only cosmetic stuff: Perltidied with xt/perltidyrc. Replaced most double quotes by single quotes around SQL statements. Moved the usage into POD for pod2usage. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9998 M. de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off --- Comment #7 from M. de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to comment #4)
Note: I did not test the feature! Too bad, but thanks anyway..
1/ It would be good to use perltidy on this new file. Fixed that
2/ Don't you think it is better to have a pod instead of the "print <<_USAGE_" stuff (and to use Pod2Usage)? Not sure, but moved it to pod.
3/ SQL strings should be between simple quotes. Also not sure about that. I replaced most of them. But had one case: " AND COALESCE(explanation,'')='' AND COALESCE(options,'')=''" where I could not replace them..
Back to Signed Off -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9998 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA --- Comment #8 from Jonathan Druart <jonathan.druart@biblibre.com> --- QA comment: Now I tested :) 1/ There is no error if the -file parameter is missing. 2/ Explanations are not restored, why don't you store them in the backup file? (explanations are useful when you search a pref without to know its name). 3/ "17 Run with -cmd compare -file zz02 -del. pref zz02 should not be deleted." returns "Adjusted (at most) 2 prefs from this compare." => but no change done. I think you should change in HandleCompareChanges: ++$t && DeleteOnePref($k) if $compare_del; with $t += DeleteOnePref($k) if $compare_del # But need to check "0E0" for 0 Maybe 2 first patches could be squashed. Marked as Failed QA. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9998 M. de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9998 --- Comment #9 from M. de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 19070 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=19070&action=edit Bug 9998: QA Followup for comparing sysprefs 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> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9998 --- Comment #10 from M. de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to comment #8)
Now I tested :) Great.
1/ There is no error if the -file parameter is missing. Shows help now.
2/ Explanations are not restored, why don't you store them in the backup file? (explanations are useful when you search a pref without to know its name). This is intentional. See bug 10199. Depends on solution there. This script got the -ign-opt parameter just for this reason.
3/ "17 Run with -cmd compare -file zz02 -del. pref zz02 should not be deleted." returns "Adjusted (at most) 2 prefs from this compare." => but no change done. At most is a maximum :) Replaced this lazy programming with your suggestion. Thanks.
-- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9998 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA QA Contact| |jonathan.druart@biblibre.co | |m --- Comment #11 from Jonathan Druart <jonathan.druart@biblibre.com> --- QA comment: Just some minor things: 1/ I hate the $_ variable loop... :) 2/ the die would be replaced with pod2usage 3/ pod2usage has a message param (in order to display "No filename given", etc.) 4/ I think that "verbose => 1" would be more appropriate for warning messages. 5/ use Modern::Perl instead of warnings ad strict I don't know if it is blocker. Let the RM takes the decision. Marked as Passed QA. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9998 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #19006|0 |1 is obsolete| | Attachment #19055|0 |1 is obsolete| | Attachment #19070|0 |1 is obsolete| | --- Comment #12 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 19074 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=19074&action=edit Bug 9998: 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> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9998 --- Comment #13 from Jonathan Druart <jonathan.druart@biblibre.com> --- Marcel, I squashed the 2 patches, I hope it is ok for you. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9998 Galen Charlton <gmcharlt@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master --- Comment #14 from Galen Charlton <gmcharlt@gmail.com> --- Pushed to master. Thanks, Marcel! -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org