From 717dca51c38964b0be1292ba9b83f5c421ac7330 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Sun, 11 Apr 2010 20:40:57 +0200 Subject: [PATCH] MT3289 : check_sysprefs.pl case sensitive variable names Variable names for systempreferences are now case sensitive. Changing check_sysprefs in relation with this change Signed-off-by: Chris Cormack (cherry picked from commit 641616ef7fd43600864d46f39b938ef3cd8cd4f3) Signed-off-by: Chris Nighswonger --- misc/check_sysprefs.pl | 50 ++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/misc/check_sysprefs.pl b/misc/check_sysprefs.pl index 0d06fde901..91d007511e 100755 --- a/misc/check_sysprefs.pl +++ b/misc/check_sysprefs.pl @@ -15,29 +15,31 @@ use C4::Context; @ARGV = qw(.) unless @ARGV; sub check_sys_pref { - my $dbh = C4::Context->dbh(); - my $query = "SELECT * FROM systempreferences WHERE variable = ?"; - my $sth = $dbh->prepare($query); - if (! -d _ ){ - my $name=$File::Find::name; - if ($name =~ /(\.pl|\.pm)$/){ - open (FILE,"$_") || die "cant open $name"; - while (my $inp = ){ - if ($inp =~ /C4::Context->preference\((.*?)\)/){ - my $variable = $1; - $variable =~s /\'|\"//g; - $sth->execute($variable); - if (my $data=$sth->fetchrow_hashref()){ - } - else { - print "$name has a reference to $variable, this does not exist in the database\n"; - } - } - } - close FILE; - } - } - $sth->finish(); + my $dbh = C4::Context->dbh(); + my $query = "SELECT * FROM systempreferences WHERE variable = ?"; + my $sth = $dbh->prepare($query); + if ( !-d _ ) { + my $name = $File::Find::name; + if ( $name =~ /(\.pl|\.pm)$/ ) { + open( FILE, "$_" ) || die "cant open $name"; + while ( my $inp = ) { + if ( $inp =~ /C4::Context->preference\((.*?)\)/ ) { + my $variable = $1; + $variable =~ s /\'|\"//g; + $sth->execute($variable); + if ( my $data = $sth->fetchrow_hashref() ) { + if ( $data->{variable} eq $variable ) { + next; + } + } + print +"$name has a reference to $variable, this does not exist in the database\n"; + } + } + close FILE; + } + } + $sth->finish(); } -find(\&check_sys_pref,@ARGV); +find( \&check_sys_pref, @ARGV ); -- 2.39.5