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>
(cherry picked from commit 6e8d24231c)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
This commit is contained in:
Jonathan Druart 2016-03-15 09:38:20 +00:00 committed by Julian Maurice
parent 03c9871ada
commit 07c842de0f
1 changed files with 6 additions and 8 deletions

View File

@ -516,6 +516,9 @@ sub preference {
$var = lc $var;
return $ENV{"OVERRIDE_SYSPREF_$var"}
if defined $ENV{"OVERRIDE_SYSPREF_$var"};
# Return the value if the var has already been accessed
if ($use_syspref_cache && exists $syspref_L1_cache{$var}) {
return $syspref_L1_cache{$var};
@ -526,14 +529,9 @@ sub preference {
: 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);