Bug 16068: Do not cache overridden prefs

These prefs do not need to be cached, a quick access to $ENV permit to
get the value.

Signed-off-by: Jacek Ablewicz <abl@biblos.pk.edu.pl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2016-03-15 09:38:20 +00:00 committed by Brendan A Gallagher
parent 714d773900
commit 6e8d24231c
1 changed files with 6 additions and 8 deletions

View File

@ -520,19 +520,17 @@ sub preference {
$var = lc $var;
return $ENV{"OVERRIDE_SYSPREF_$var"}
if defined $ENV{"OVERRIDE_SYSPREF_$var"};
my $cached_var = $use_syspref_cache
? $syspref_cache->get_from_cache("syspref_$var")
: undef;
return $cached_var if defined $cached_var;
my $value;
if ( defined $ENV{"OVERRIDE_SYSPREF_$var"} ) {
$value = $ENV{"OVERRIDE_SYSPREF_$var"};
} else {
my $syspref;
eval { $syspref = Koha::Config::SysPrefs->find( lc $var ) };
$value = $syspref ? $syspref->value() : undef;
}
my $syspref;
eval { $syspref = Koha::Config::SysPrefs->find( lc $var ) };
my $value = $syspref ? $syspref->value() : undef;
if ( $use_syspref_cache ) {
$syspref_cache->set_in_cache("syspref_$var", $value);