Bug 24272: Use Pod2Usage and surround values with ''

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2021-01-20 10:02:10 +01:00
parent a9ea5d1ba4
commit b191529344

View file

@ -16,6 +16,8 @@
# along with Koha; if not, see <http://www.gnu.org/licenses>. # along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl; use Modern::Perl;
use Getopt::Long;
use Pod::Usage;
use Koha::Script; use Koha::Script;
use Koha::Caches; use Koha::Caches;
@ -36,6 +38,14 @@ Catch data inconsistencies in cached sysprefs vs those in the database
=cut =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 $syspref_cache = Koha::Caches->get_instance('syspref');
my $prefs = Koha::Config::SysPrefs->search(); my $prefs = Koha::Config::SysPrefs->search();
@ -44,5 +54,6 @@ while (my $pref = $prefs->next) {
my $var = lc $pref->variable; my $var = lc $pref->variable;
my $cached_var = $syspref_cache->get_from_cache("syspref_$var"); 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 next unless defined $cached_var; #If not defined in cache we will fetch from DB so this case is OK
print "$var: value in cache is $cached_var and value in db is ".$pref->value,"\n" unless $cached_var eq $pref->value; say sprintf( "%s: value in cache is '%s' and value in db is '%s'", $var, $cached_var, $pref->value )
unless $cached_var eq $pref->value;
} }