Bugzilla – Attachment 73521 Details for
Bug 20116
Improve performance by caching the language list
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20116: Cache language list
Bug-20116-Cache-language-list.patch (text/plain), 1.73 KB, created by
Jonathan Druart
on 2018-04-02 14:09:42 UTC
(
hide
)
Description:
Bug 20116: Cache language list
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-04-02 14:09:42 UTC
Size:
1.73 KB
patch
obsolete
>From b6adf5094ba03ee3e41b38087a144e28c3a541a6 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 31 Jan 2018 14:51:22 -0300 >Subject: [PATCH] Bug 20116: Cache language list > >--- > C4/Languages.pm | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > >diff --git a/C4/Languages.pm b/C4/Languages.pm >index 3693abdc96..c7217c67f1 100644 >--- a/C4/Languages.pm >+++ b/C4/Languages.pm >@@ -26,6 +26,7 @@ use Carp; > use CGI; > use List::MoreUtils qw( any ); > use C4::Context; >+use Koha::Caches; > use Koha::Cache::Memory::Lite; > use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $DEBUG); > >@@ -117,13 +118,18 @@ sub getTranslatedLanguages { > ? split ",", C4::Context->preference('language') > : split ",", C4::Context->preference('opaclanguage'); > >+ my $cache = Koha::Caches->get_instance; > if ($interface && $interface eq 'opac' ) { > my $htdocs = C4::Context->config('opachtdocs'); >- @languages = _get_opac_language_dirs( $htdocs, $theme ); >+ my $cached = $cache->get_from_cache('languages_opac_'.$theme); >+ @languages = $cached ? @{$cached} : _get_opac_language_dirs( $htdocs, $theme ); >+ $cache->set_in_cache('languages_opac_'.$theme, \@languages ); > } > elsif ($interface && $interface eq 'intranet' ) { > my $htdocs = C4::Context->config('intrahtdocs'); >- @languages = _get_intranet_language_dirs( $htdocs, $theme ); >+ my $cached = $cache->get_from_cache('languages_intranet_'.$theme); >+ @languages = $cached ? @{$cached} : _get_intranet_language_dirs( $htdocs, $theme ); >+ $cache->set_in_cache('languages_intranet_'.$theme, \@languages ); > } > else { > my $htdocs = C4::Context->config('intrahtdocs'); >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20116
:
71097
|
71098
|
73521
|
73619
|
73620
|
75382
|
75383
|
75384
|
75385
|
88200
|
88201
|
88202
|
94995
|
94996
|
94997
|
99431
|
99432
|
99433
|
103007
|
103008
|
103009
|
105359