|
Lines 249-255
sub new {
Link Here
|
| 249 |
my $conf_cache = Koha::Caches->get_instance('config'); |
249 |
my $conf_cache = Koha::Caches->get_instance('config'); |
| 250 |
my $config_from_cache; |
250 |
my $config_from_cache; |
| 251 |
if ( $conf_cache->cache ) { |
251 |
if ( $conf_cache->cache ) { |
| 252 |
$self = $conf_cache->get_from_cache('koha_conf'); |
252 |
my $last_modification_time_cached = |
|
|
253 |
$conf_cache->get_from_cache('last_modification_time'); |
| 254 |
my $last_modification_time = qx{stat --format %Y $conf_fname}; |
| 255 |
|
| 256 |
# There must be nothing in cache (or the last modification does not exist yet) |
| 257 |
unless ($last_modification_time_cached) { |
| 258 |
$conf_cache->set_in_cache( 'last_modification_time', |
| 259 |
$last_modification_time ); |
| 260 |
} |
| 261 |
# The config file needs to be reread, it has been changed since the last init of C4::Context |
| 262 |
elsif ( $last_modification_time > $last_modification_time_cached ) { |
| 263 |
$conf_cache->flush_all; |
| 264 |
$conf_cache->set_in_cache( 'last_modification_time', |
| 265 |
$last_modification_time ); |
| 266 |
} |
| 267 |
# We can use the data from the cache |
| 268 |
else { |
| 269 |
$self = $conf_cache->get_from_cache('koha_conf'); |
| 270 |
} |
| 253 |
} |
271 |
} |
| 254 |
unless ( $self and %$self ) { |
272 |
unless ( $self and %$self ) { |
| 255 |
$self = Koha::Config->read_from_file($conf_fname); |
273 |
$self = Koha::Config->read_from_file($conf_fname); |