From 031792f946ae79b81c2f19e8cfb9999a966a14a1 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 7 Mar 2019 15:17:18 -0300 Subject: [PATCH] Bug 22473: flush in psgi - V1 Here we are checking on each request That could work, but do not feel robust Moreover it will not affect scripts outside of plack --- debian/templates/plack.psgi | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/debian/templates/plack.psgi b/debian/templates/plack.psgi index 3538b9a5a1..ce36d01e20 100644 --- a/debian/templates/plack.psgi +++ b/debian/templates/plack.psgi @@ -46,6 +46,21 @@ 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(); + + my $conf_fname = Koha::Config->guess_koha_conf; + my $conf_cache = Koha::Caches->get_instance('config'); + if ( $conf_cache->cache ) { + my $last_modification_time_cached = $conf_cache->get_from_cache('last_modification_time'); + my $last_modification_time = qx{stat --format %Y $conf_fname}; + unless ( $last_modification_time_cached ) { + $conf_cache->set_in_cache('last_modification_time', $last_modification_time) + } + elsif ( $last_modification_time > $last_modification_time_cached ) { + $conf_cache->flush_all; + $conf_cache->set_in_cache('last_modification_time', $last_modification_time) + } + } + return $q; }; } -- 2.11.0