fix malformed call of XSLTParse4Display
[koha.git] / misc / check_sysprefs.pl
1 #!/usr/bin/perl
2
3 # script to test for missing systempreferences
4 # export KOHA_CONF
5 # export PERL5LIB
6 # then ./check_sysprefs.pl path  (if path is blank it will use .)
7
8 use strict;
9 use warnings;
10
11 use File::Find;
12
13 use C4::Context;
14
15 @ARGV = qw(.) unless @ARGV;
16
17 sub check_sys_pref {
18         my $dbh = C4::Context->dbh();
19         my $query = "SELECT * FROM systempreferences WHERE variable = ?";
20         my $sth = $dbh->prepare($query);        
21         if (! -d _ ){
22                 my $name=$File::Find::name;
23                 if ($name =~ /(\.pl|\.pm)$/){
24                         open (FILE,"$_") || die "cant open $name";
25                         while (my $inp = <FILE>){
26                                 if ($inp =~ /C4::Context->preference\((.*?)\)/){
27                                         my $variable = $1;
28                                         $variable =~s /\'|\"//g;
29                                         $sth->execute($variable);
30                                         if (my $data=$sth->fetchrow_hashref()){
31                                         }
32                                         else {
33                                                 print "$name has a reference to $variable, this does not exist in the database\n";
34                                         }
35                                 }
36                         }
37                         close FILE;
38                 }
39         }
40         $sth->finish();
41 }
42
43 find(\&check_sys_pref,@ARGV);