corrected init script name for apache2
[koha.git] / check_sysprefs.pl
blob06ed80644e4de744f9d7206ae2c07108e25fa17d
1 #!/usr/bin/perl
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 .)
8 use File::Find;
9 use C4::Context;
11 @ARGV = qw(.) unless @ARGV;
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()){
28 else {
29 print "$name has a reference to $variable, this does not exist in the database\n";
33 close FILE;
36 $sth->finish();
39 find(\&check_sys_pref,@ARGV);