From 27b756eb91e0ce93f46233dabe3957a66e978d4d Mon Sep 17 00:00:00 2001 From: Jesse Weaver Date: Fri, 13 May 2016 16:39:08 -0600 Subject: [PATCH] Bug 16520: Initialize the sysprefs Koha::Caches on demand Signed-off-by: Tomas Cohen Arazi Signed-off-by: Kyle M Hall --- C4/Context.pm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/C4/Context.pm b/C4/Context.pm index 5f49bbedd6..1866b1d85f 100644 --- a/C4/Context.pm +++ b/C4/Context.pm @@ -407,15 +407,16 @@ sub preference { my $self = shift; my $var = shift; # The system preference to return - $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; + $var = lc $var; + + if ($use_syspref_cache) { + $syspref_cache = Koha::Cache->get_instance() unless $syspref_cache; + my $cached_var = $syspref_cache->get_from_cache("syspref_$var"); + return $cached_var if defined $cached_var; + } my $syspref; eval { $syspref = Koha::Config::SysPrefs->find( lc $var ) }; -- 2.39.5