3 # script to test for missing systempreferences
6 # then ./check_sysprefs.pl path (if path is blank it will use .)
15 @ARGV = qw(.) unless @ARGV;
18 my $dbh = C4::Context->dbh();
19 my $query = "SELECT * FROM systempreferences WHERE variable = ?";
20 my $sth = $dbh->prepare($query);
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\((.*?)\)/ ) {
28 $variable =~ s /\'|\"//g;
29 $sth->execute($variable);
30 if ( my $data = $sth->fetchrow_hashref() ) {
31 if ( $data->{variable} eq $variable ) {
36 "$name has a reference to $variable, this does not exist in the database\n";
45 find( \&check_sys_pref, @ARGV );