Bugzilla – Attachment 86630 Details for
Bug 22473
Use koha-conf.xml modification time as cache key
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22473: Handle config expiration in C4::Context->new - V3
Bug-22473-Handle-config-expiration-in-C4Context-ne.patch (text/plain), 2.18 KB, created by
Jonathan Druart
on 2019-03-14 18:51:20 UTC
(
hide
)
Description:
Bug 22473: Handle config expiration in C4::Context->new - V3
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2019-03-14 18:51:20 UTC
Size:
2.18 KB
patch
obsolete
>From c048dda74e5f8637dc0074fb0d92c839be15b7fb Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 7 Mar 2019 15:37:25 -0300 >Subject: [PATCH] Bug 22473: Handle config expiration in C4::Context->new - V3 > >--- > C4/Context.pm | 20 +++++++++++++++++++- > debian/templates/plack.psgi | 1 + > 2 files changed, 20 insertions(+), 1 deletion(-) > >diff --git a/C4/Context.pm b/C4/Context.pm >index 9b3f74dbb2..1e92922560 100644 >--- a/C4/Context.pm >+++ b/C4/Context.pm >@@ -249,7 +249,25 @@ sub new { > my $conf_cache = Koha::Caches->get_instance('config'); > my $config_from_cache; > if ( $conf_cache->cache ) { >- $self = $conf_cache->get_from_cache('koha_conf'); >+ my $last_modification_time_cached = >+ $conf_cache->get_from_cache('last_modification_time'); >+ my $last_modification_time = qx{stat --format %Y $conf_fname}; >+ >+ # There must be nothing in cache (or the last modification does not exist yet) >+ unless ($last_modification_time_cached) { >+ $conf_cache->set_in_cache( 'last_modification_time', >+ $last_modification_time ); >+ } >+ # The config file needs to be reread, it has been changed since the last init of C4::Context >+ elsif ( $last_modification_time > $last_modification_time_cached ) { >+ $conf_cache->flush_all; >+ $conf_cache->set_in_cache( 'last_modification_time', >+ $last_modification_time ); >+ } >+ # We can use the data from the cache >+ else { >+ $self = $conf_cache->get_from_cache('koha_conf'); >+ } > } > unless ( $self and %$self ) { > $self = Koha::Config->read_from_file($conf_fname); >diff --git a/debian/templates/plack.psgi b/debian/templates/plack.psgi >index 3538b9a5a1..bb2ae6f0f6 100644 >--- a/debian/templates/plack.psgi >+++ b/debian/templates/plack.psgi >@@ -46,6 +46,7 @@ use CGI qw(-utf8 ); # we will loose -utf8 under plack, otherwise > $CGI::PARAM_UTF8 = 1; > Koha::Caches->flush_L1_caches(); > Koha::Cache::Memory::Lite->flush(); >+ C4::Context->new; # Any side effects to expect from this? > return $q; > }; > } >-- >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 22473
:
86628
|
86629
| 86630 |
86631