From 6e8d24231c03775422f403a76ca41ccf22f40558 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 15 Mar 2016 09:38:20 +0000 Subject: [PATCH] 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 Signed-off-by: Martin Renvoize Signed-off-by: Brendan A Gallagher --- C4/Context.pm | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/C4/Context.pm b/C4/Context.pm index 6b70b60fe2..c80647a87a 100644 --- a/C4/Context.pm +++ b/C4/Context.pm @@ -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); -- 2.39.5