From d4cd289429db08cc3b928cf6cb1bb40adeb1f4e2 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 22 Jun 2016 16:02:08 +0100 Subject: [PATCH] Bug 17189: Add the ability to define several memcached namespaces - replace existing occurrences s/Koha::Cache->get_instance/Koha::Caches->get_instance Signed-off-by: Jacek Ablewicz Signed-off-by: Tomas Cohen Arazi https://bugs.koha-community.org/show_bug.cgi?id=11921 --- C4/Biblio.pm | 4 ++-- C4/Calendar.pm | 14 +++++++------- C4/Context.pm | 2 +- C4/External/OverDrive.pm | 2 +- C4/Items.pm | 2 +- C4/Koha.pm | 2 +- C4/Utils/DataTables/ColumnsSettings.pm | 2 +- Koha/Calendar.pm | 4 ++-- Koha/Template/Plugin/Cache.pm | 2 +- admin/biblio_framework.pl | 2 +- admin/koha2marclinks.pl | 2 +- admin/marc_subfields_structure.pl | 2 +- admin/marctagstructure.pl | 2 +- opac/svc/report | 2 +- svc/report | 2 +- t/Calendar.t | 2 +- t/db_dependent/Filter_MARC_ViewPolicy.t | 2 +- t/db_dependent/Items.t | 4 ++-- tools/newHolidays.pl | 2 +- 19 files changed, 28 insertions(+), 28 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 3a34d79..8865daa 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -1122,7 +1122,7 @@ sub GetMarcStructure { $frameworkcode = "" unless $frameworkcode; $forlibrarian = $forlibrarian ? 1 : 0; - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); my $cache_key = "MarcStructure-$forlibrarian-$frameworkcode"; my $cached = $cache->get_from_cache($cache_key); return $cached if $cached; @@ -1230,7 +1230,7 @@ sub GetMarcSubfieldStructure { $frameworkcode //= ''; - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); my $cache_key = "MarcSubfieldStructure-$frameworkcode"; my $cached = $cache->get_from_cache($cache_key); return $cached if $cached; diff --git a/C4/Calendar.pm b/C4/Calendar.pm index 82dc35a..18a23ab 100644 --- a/C4/Calendar.pm +++ b/C4/Calendar.pm @@ -276,7 +276,7 @@ sub insert_single_holiday { # changed the 'single_holidays' table, lets force/reset its cache - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); $cache->clear_from_cache( 'single_holidays') ; $cache->clear_from_cache( 'exception_holidays') ; @@ -321,7 +321,7 @@ sub insert_exception_holiday { $self->{'exception_holidays'}->{"$options{year}/$options{month}/$options{day}"}{description} = $options{description}; # changed the 'single_holidays' table, lets force/reset its cache - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); $cache->clear_from_cache( 'single_holidays') ; $cache->clear_from_cache( 'exception_holidays') ; @@ -422,7 +422,7 @@ UPDATE special_holidays SET title = ?, description = ? $self->{'single_holidays'}->{"$options{year}/$options{month}/$options{day}"}{description} = $options{description}; # changed the 'single_holidays' table, lets force/reset its cache - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); $cache->clear_from_cache( 'single_holidays') ; $cache->clear_from_cache( 'exception_holidays') ; @@ -465,7 +465,7 @@ UPDATE special_holidays SET title = ?, description = ? $self->{'exception_holidays'}->{"$options{year}/$options{month}/$options{day}"}{description} = $options{description}; # changed the 'single_holidays' table, lets force/reset its cache - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); $cache->clear_from_cache( 'single_holidays') ; $cache->clear_from_cache( 'exception_holidays') ; @@ -546,7 +546,7 @@ sub delete_holiday { } # changed the 'single_holidays' table, lets force/reset its cache - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); $cache->clear_from_cache( 'single_holidays') ; $cache->clear_from_cache( 'exception_holidays') ; @@ -577,7 +577,7 @@ sub delete_holiday_range { $sth->execute($self->{branchcode}, $options{day}, $options{month}, $options{year}); # changed the 'single_holidays' table, lets force/reset its cache - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); $cache->clear_from_cache( 'single_holidays') ; $cache->clear_from_cache( 'exception_holidays') ; @@ -631,7 +631,7 @@ sub delete_exception_holiday_range { $sth->execute($self->{branchcode}, $options{day}, $options{month}, $options{year}); # changed the 'single_holidays' table, lets force/reset its cache - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); $cache->clear_from_cache( 'single_holidays') ; $cache->clear_from_cache( 'exception_holidays') ; } diff --git a/C4/Context.pm b/C4/Context.pm index baed482..cb3c966 100644 --- a/C4/Context.pm +++ b/C4/Context.pm @@ -511,7 +511,7 @@ with this method. =cut -my $syspref_cache = Koha::Cache->get_instance(); +my $syspref_cache = Koha::Caches->get_instance(); my $use_syspref_cache = 1; sub preference { my $self = shift; diff --git a/C4/External/OverDrive.pm b/C4/External/OverDrive.pm index 12135c5..1093a1b 100644 --- a/C4/External/OverDrive.pm +++ b/C4/External/OverDrive.pm @@ -99,7 +99,7 @@ sub GetOverDriveToken { my $cache; - eval { $cache = Koha::Cache->get_instance() }; + eval { $cache = Koha::Caches->get_instance() }; my $token; $cache and $token = $cache->get_from_cache( "overdrive_token" ) and return $token; diff --git a/C4/Items.pm b/C4/Items.pm index 41bd03a..dd7614c 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -454,7 +454,7 @@ Returns item record sub _build_default_values_for_mod_marc { my ($frameworkcode) = @_; - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); my $cache_key = "default_value_for_mod_marc-$frameworkcode"; my $cached = $cache->get_from_cache($cache_key); return $cached if $cached; diff --git a/C4/Koha.pm b/C4/Koha.pm index bb35811..d82ad1e 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -1017,7 +1017,7 @@ sub GetAuthorisedValues { C4::Context->userenv ? C4::Context->userenv->{"branch"} : ""; my $cache_key = "AuthorisedValues-$category-$opac-$branch_limit"; - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); my $result = $cache->get_from_cache($cache_key); return $result if $result; diff --git a/C4/Utils/DataTables/ColumnsSettings.pm b/C4/Utils/DataTables/ColumnsSettings.pm index a107886..9e838d6 100644 --- a/C4/Utils/DataTables/ColumnsSettings.pm +++ b/C4/Utils/DataTables/ColumnsSettings.pm @@ -9,7 +9,7 @@ use Koha::Cache; sub get_yaml { my $yml_path = C4::Context->config('intranetdir') . '/admin/columns_settings.yml'; - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); my $yaml = $cache->get_from_cache('ColumnsSettingsYaml'); unless ($yaml) { diff --git a/Koha/Calendar.pm b/Koha/Calendar.pm index 1321621..4b48ae2 100644 --- a/Koha/Calendar.pm +++ b/Koha/Calendar.pm @@ -55,7 +55,7 @@ sub _init { sub exception_holidays { my ( $self ) = @_; - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); my $cached = $cache->get_from_cache('exception_holidays'); return $cached if $cached; @@ -84,7 +84,7 @@ sub exception_holidays { sub single_holidays { my ( $self, $date ) = @_; my $branchcode = $self->{branchcode}; - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); my $single_holidays = $cache->get_from_cache('single_holidays'); # $single_holidays looks like: diff --git a/Koha/Template/Plugin/Cache.pm b/Koha/Template/Plugin/Cache.pm index dbb1c82..5e3f8f7 100644 --- a/Koha/Template/Plugin/Cache.pm +++ b/Koha/Template/Plugin/Cache.pm @@ -35,7 +35,7 @@ sub new { } else { require Koha::Cache; - $cache = Koha::Cache->get_instance(); + $cache = Koha::Caches->get_instance(); } my $self = bless { CACHE => $cache, diff --git a/admin/biblio_framework.pl b/admin/biblio_framework.pl index 3aeb0ca..57839b9 100755 --- a/admin/biblio_framework.pl +++ b/admin/biblio_framework.pl @@ -31,7 +31,7 @@ use Koha::Cache; my $input = new CGI; my $frameworkcode = $input->param('frameworkcode') || q||; my $op = $input->param('op') || q|list|; -my $cache = Koha::Cache->get_instance(); +my $cache = Koha::Caches->get_instance(); my @messages; my ( $template, $borrowernumber, $cookie ) = get_template_and_user( diff --git a/admin/koha2marclinks.pl b/admin/koha2marclinks.pl index 9ccca37..d8fd569 100755 --- a/admin/koha2marclinks.pl +++ b/admin/koha2marclinks.pl @@ -59,7 +59,7 @@ else { } my $dbh = C4::Context->dbh; -my $cache = Koha::Cache->get_instance(); +my $cache = Koha::Caches->get_instance(); ################## ADD_FORM ################################## # called by default. Used to create form to add or modify a record diff --git a/admin/marc_subfields_structure.pl b/admin/marc_subfields_structure.pl index 096b9ec..ea1373e 100755 --- a/admin/marc_subfields_structure.pl +++ b/admin/marc_subfields_structure.pl @@ -77,7 +77,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( debug => 1, } ); -my $cache = Koha::Cache->get_instance(); +my $cache = Koha::Caches->get_instance(); my $op = $input->param('op') || ""; $tagfield =~ s/\,//g; diff --git a/admin/marctagstructure.pl b/admin/marctagstructure.pl index 2b4f2a1..3ea47ed 100755 --- a/admin/marctagstructure.pl +++ b/admin/marctagstructure.pl @@ -46,7 +46,7 @@ my $pagesize = 20; my $script_name = "/cgi-bin/koha/admin/marctagstructure.pl"; my $dbh = C4::Context->dbh; -my $cache = Koha::Cache->get_instance(); +my $cache = Koha::Caches->get_instance(); # open template my ($template, $loggedinuser, $cookie) diff --git a/opac/svc/report b/opac/svc/report index bfc84e5..9cc21a3 100755 --- a/opac/svc/report +++ b/opac/svc/report @@ -41,7 +41,7 @@ die "Sorry this report is not public\n" unless $report_rec->{public}; my @sql_params = $query->param('sql_params'); -my $cache = Koha::Cache->get_instance(); +my $cache = Koha::Caches->get_instance(); my $cache_active = $cache->is_cache_active; my ($cache_key, $json_text); if ($cache_active) { diff --git a/svc/report b/svc/report index da1b9b3..c7e4053 100755 --- a/svc/report +++ b/svc/report @@ -48,7 +48,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( } ); -my $cache = Koha::Cache->get_instance(); +my $cache = Koha::Caches->get_instance(); my $cache_active = $cache->is_cache_active; my ($cache_key, $json_text); if ($cache_active) { diff --git a/t/Calendar.t b/t/Calendar.t index 4d48c02..7563753 100755 --- a/t/Calendar.t +++ b/t/Calendar.t @@ -89,7 +89,7 @@ fixtures_ok [ ], ], "add fixtures"; -my $cache = Koha::Cache->get_instance(); +my $cache = Koha::Caches->get_instance(); $cache->clear_from_cache( 'single_holidays') ; # 'MPL' branch is arbitrary, is not used at all but is needed for initialization diff --git a/t/db_dependent/Filter_MARC_ViewPolicy.t b/t/db_dependent/Filter_MARC_ViewPolicy.t index ba446bc..709aea9 100644 --- a/t/db_dependent/Filter_MARC_ViewPolicy.t +++ b/t/db_dependent/Filter_MARC_ViewPolicy.t @@ -71,7 +71,7 @@ sub run_hiding_tests { $sth->execute($hidden_value); - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); $cache->flush_all(); # easy way to ensure DB is queried again. my $processor = Koha::RecordProcessor->new( diff --git a/t/db_dependent/Items.t b/t/db_dependent/Items.t index b494a70..3e886e2 100755 --- a/t/db_dependent/Items.t +++ b/t/db_dependent/Items.t @@ -380,7 +380,7 @@ subtest 'SearchItems test' => sub { $dbh->do('INSERT INTO marc_subfield_structure (tagfield, tagsubfield, frameworkcode) VALUES (?, "z", ?)', undef, $itemfield, $frameworkcode); # Clear cache - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); $cache->clear_from_cache("MarcStructure-0-$frameworkcode"); $cache->clear_from_cache("MarcStructure-1-$frameworkcode"); $cache->clear_from_cache("default_value_for_mod_marc-$frameworkcode"); @@ -644,7 +644,7 @@ subtest 'C4::Items::_build_default_values_for_mod_marc' => sub { |, undef, $framework->{frameworkcode} ); # And make sure the caches are cleared - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); $cache->clear_from_cache("MarcStructure-0-" . $framework->{frameworkcode}); $cache->clear_from_cache("MarcStructure-1-" . $framework->{frameworkcode}); $cache->clear_from_cache("default_value_for_mod_marc-" . $framework->{frameworkcode}); diff --git a/tools/newHolidays.pl b/tools/newHolidays.pl index eda4c1b..f36f0e0 100755 --- a/tools/newHolidays.pl +++ b/tools/newHolidays.pl @@ -129,6 +129,6 @@ sub add_holiday { } } # we updated the single_holidays table, so wipe its cache - my $cache = Koha::Cache->get_instance(); + my $cache = Koha::Caches->get_instance(); $cache->clear_from_cache( 'single_holidays') ; } -- 2.7.4