Koha/misc/maintenance/check_syspref_cache.pl
Magnus Enger 6a0cd4cc5e
Bug 32922: Remove space in shebang
Some of our scripts have a space in the "shebang" (first) line:

  #! /usr/bin/perl

This is not illegal, and it does work, but it is good to be
consistent, so this patch removes the space.

To test:
- Run: grep -rn --include=*.pl '#! /usr/' *
- See the list of files that have a space in the shebang
- Apply the patch
- Run the command again, there should be no output, meaning there
  are no more files with space in the shebang
- Have a look at the patch and check that it only changes the
  shebangs
- Sign off

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-02-20 09:44:06 -03:00

60 lines
1.7 KiB
Perl
Executable file

#!/usr/bin/perl
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Koha is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl;
use Getopt::Long qw( GetOptions );
use Pod::Usage qw( pod2usage );
use Encode qw( encode_utf8 );
use Koha::Script;
use Koha::Caches;
use Koha::Config::SysPrefs;
use C4::Context;
=head1 NAME
check_syspref_cache.pl
=head1 SYNOPSIS
perl check_syspref_cache.pl
=head1 DESCRIPTION
Catch data inconsistencies in cached sysprefs vs those in the database
=cut
my ( $help, $man );
GetOptions(
'help|?' => \$help,
'man' => \$man,
);
pod2usage(1) if $help;
pod2usage( -verbose => 2 ) if $man;
my $syspref_cache = Koha::Caches->get_instance('syspref');
my $prefs = Koha::Config::SysPrefs->search();
while (my $pref = $prefs->next) {
my $var = lc $pref->variable;
my $cached_var = $syspref_cache->get_from_cache("syspref_$var");
next unless defined $cached_var; #If not defined in cache we will fetch from DB so this case is OK
say encode_utf8( sprintf( "%s: value in cache is '%s' and value in db is '%s'", $var, $cached_var, $pref->value ) )
unless $cached_var eq $pref->value;
}