From 548f4f72d52679e609f35d96c47ea435fb35611e Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 8 Oct 2014 14:27:40 +0200 Subject: [PATCH] Bug 13028: Followup adding a -partial flag for partial compares Content-Type: text/plain; charset=utf-8 If you compare the database with a partial pref file, you may not be interested in lots of lines saying that a pref is not in the file. You were already aware of that ;) If you add the -partial flag, these lines will be skipped. Test plan: Do as described above. --- misc/maintenance/cmp_sysprefs.pl | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/misc/maintenance/cmp_sysprefs.pl b/misc/maintenance/cmp_sysprefs.pl index bed32a2..57f2b42 100755 --- a/misc/maintenance/cmp_sysprefs.pl +++ b/misc/maintenance/cmp_sysprefs.pl @@ -33,7 +33,7 @@ use Pod::Usage; use C4::Context; my $dbh = C4::Context->dbh; -my ( $help, $cmd, $filename, $override, $compare_add, $compare_del, $compare_upd, $ignore_opt ); +my ( $help, $cmd, $filename, $override, $compare_add, $compare_del, $compare_upd, $ignore_opt, $partial ); GetOptions( 'help' => \$help, 'cmd:s' => \$cmd, @@ -42,6 +42,7 @@ GetOptions( 'del' => \$compare_del, 'upd' => \$compare_upd, 'ign-opt' => \$ignore_opt, + 'partial' => \$partial, ); if ( $filename && !-e $filename && $cmd !~ /^b/ ) { @@ -98,6 +99,7 @@ sub PrintCompare { my ( $ch, $s1, $s2 ) = @_; foreach ( sort keys %$ch ) { my $v = $ch->{$_}; + next if $v eq '1' && $partial; print "$_: "; if ( $v eq '1' ) { print "Not in $s2"; } elsif ( $v eq '2' ) { print "Not in $s1"; } @@ -308,6 +310,10 @@ Command: backup, compare, restore or test. Name of the file used in command. +=item B<-partial> + +Only for partial compares: skip 'not present in file'-messages. + =item B<-add> Only for compares: restore preferences not present in database. -- 1.7.7.6