From 34810bfe3b09307a6cf9ac66467f93c8f8e39394 Mon Sep 17 00:00:00 2001 From: Jacek Ablewicz Date: Tue, 15 Mar 2016 17:26:48 +0100 Subject: [PATCH] Bug 16079 - Bug 16079 - Retrieving system preferences from database via DBIx is not fast enough Bug 13967 introduced some perfomance issues (80+ miliseconds added to the run time of the average CGI script, on the fast server). After Bug 11998, this is now efectivelly resolved for Koha + memcache setups, but Koha + Cache::Memory (= default caching system) setups are still affected. To address that, this patch reverts a small (most speed-sensitive) part of Bug 11998. Hopefully, this solution is only temporary, to be reverted when (if) better one will become available. Test plan: 1) apply patch 2) run t/* tests 3) drop database contents to trigger an installer, ensure that you can advance at least to the step #2 without encountering any problems --- C4/Context.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/C4/Context.pm b/C4/Context.pm index 95cf3e6..c5839fa 100644 --- a/C4/Context.pm +++ b/C4/Context.pm @@ -526,9 +526,13 @@ sub preference { : undef; return $cached_var if defined $cached_var; - my $syspref; - eval { $syspref = Koha::Config::SysPrefs->find( lc $var ) }; - my $value = $syspref ? $syspref->value() : undef; + # DBIx variant temporarily disabled due to performance issues + # my $syspref; + # eval { $syspref = Koha::Config::SysPrefs->find( lc $var ) }; + # my $value = $syspref ? $syspref->value() : undef; + my $dbh = C4::Context->dbh; + my $query = 'SELECT value FROM systempreferences WHERE variable = ? LIMIT 1'; + my $value = $dbh->selectrow_array($query, {}, $var); if ( $use_syspref_cache ) { $syspref_cache->set_in_cache("syspref_$var", $value); -- 1.7.10.4