3 # script to test for missing systempreferences
6 # then ./check_sysprefs.pl path (if path is blank it will use .)
16 @ARGV = qw(.) unless @ARGV;
19 my $dbh = C4
::Context
->dbh();
20 my $query = "SELECT * FROM systempreferences WHERE variable = ?";
21 my $sth = $dbh->prepare($query);
23 my $name = $File::Find
::name
;
24 if ( $name =~ /(\.pl|\.pm)$/ ) {
25 open( my $fh, '<', $_ ) || die "can't open $name";
26 while ( my $inp = <$fh> ) {
27 if ( $inp =~ /C4::Context->preference\((.*?)\)/ ) {
29 $variable =~ s
/\'|\"//g
;
30 $sth->execute($variable);
31 if ( my $data = $sth->fetchrow_hashref() ) {
32 if ( $data->{variable
} eq $variable ) {
37 "$name has a reference to $variable, this does not exist in the database\n";
46 find
( \
&check_sys_pref
, @ARGV );