Lines 5-18
use List::Util qw( first );
Link Here
|
5 |
use YAML; |
5 |
use YAML; |
6 |
use C4::Context; |
6 |
use C4::Context; |
7 |
use Koha::Database; |
7 |
use Koha::Database; |
|
|
8 |
use Koha::Cache; |
8 |
|
9 |
|
9 |
sub get_yaml { |
10 |
sub get_yaml { |
10 |
my $yml_path = |
11 |
my $yml_path = C4::Context->config('intranetdir') . '/admin/columns_settings.yml'; |
11 |
C4::Context->config('intranetdir') . '/admin/columns_settings.yml'; |
12 |
my $cache = Koha::Cache->get_instance(); |
12 |
my $yaml = eval { YAML::LoadFile($yml_path) }; |
13 |
my $yaml = $cache->get_from_cache('ColumnsSettingsYaml'); |
13 |
warn |
14 |
|
14 |
"ERROR: the yaml file for DT::ColumnsSettings is not correctly formated: $@" |
15 |
unless ($yaml) { |
15 |
if $@; |
16 |
$yaml = eval { YAML::LoadFile($yml_path) }; |
|
|
17 |
warn "ERROR: the yaml file for DT::ColumnsSettings is not correctly formated: $@" |
18 |
if $@; |
19 |
$cache->set_in_cache( 'ColumnsSettingsYaml', $yaml, { expiry => 3600 } ); |
20 |
} |
16 |
return $yaml; |
21 |
return $yaml; |
17 |
} |
22 |
} |
18 |
|
23 |
|
19 |
- |
|
|