X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=misc%2Fcheck_sysprefs.pl;h=91d007511eb47acaf4509feab431576100fa5473;hb=985eb929149737571e3830c837a127ab372e42fe;hp=06ed80644e4de744f9d7206ae2c07108e25fa17d;hpb=dd50153f00f0ed950ca3eb412cd0a46be4d1048f;p=koha.git diff --git a/misc/check_sysprefs.pl b/misc/check_sysprefs.pl index 06ed80644e..91d007511e 100755 --- a/misc/check_sysprefs.pl +++ b/misc/check_sysprefs.pl @@ -5,35 +5,41 @@ # export PERL5LIB # then ./check_sysprefs.pl path (if path is blank it will use .) +use strict; +use warnings; + use File::Find; + 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 );