bib_profile web svc: report biblioitems.itemtype subfield as non-mandatory
[wip/koha-chris_n.git] / 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 File::Find;
9 use C4::Context;
10
11 @ARGV = qw(.) unless @ARGV;
12
13 sub check_sys_pref {
14         my $dbh = C4::Context->dbh();
15         my $query = "SELECT * FROM systempreferences WHERE variable = ?";
16         my $sth = $dbh->prepare($query);        
17         if (! -d _ ){
18                 my $name=$File::Find::name;
19                 if ($name =~ /(\.pl|\.pm)$/){
20                         open (FILE,"$_") || die "cant open $name";
21                         while (my $inp = <FILE>){
22                                 if ($inp =~ /C4::Context->preference\((.*?)\)/){
23                                         my $variable = $1;
24                                         $variable =~s /\'|\"//g;
25                                         $sth->execute($variable);
26                                         if (my $data=$sth->fetchrow_hashref()){
27                                         }
28                                         else {
29                                                 print "$name has a reference to $variable, this does not exist in the database\n";
30                                         }
31                                 }
32                         }
33                         close FILE;
34                 }
35         }
36         $sth->finish();
37 }
38         
39 find(\&check_sys_pref,@ARGV);