Bug 31196: Remove 'default_value_for_mod_marc-' clear_from_cache calls

We are seeing the following lines several times in the codebase
  $cache->clear_from_cache("default_value_for_mod_marc-");

But values are never set for this key.

Test plan:
Ask you, "Is the above correct?"
Use the correct 'git grep' and 'git log' and confirm the assertion.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 93d44d1875)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2022-07-20 09:38:57 +02:00 committed by Lucas Gass
parent 13ec1f0de4
commit 867c03bf6a
12 changed files with 1 additions and 23 deletions

View file

@ -78,7 +78,6 @@ if ( $op eq 'add_form' ) {
} }
$cache->clear_from_cache("MarcStructure-0-$frameworkcode"); $cache->clear_from_cache("MarcStructure-0-$frameworkcode");
$cache->clear_from_cache("MarcStructure-1-$frameworkcode"); $cache->clear_from_cache("MarcStructure-1-$frameworkcode");
$cache->clear_from_cache("default_value_for_mod_marc-");
$cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode"); $cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode");
$cache->clear_from_cache("MarcCodedFields-$frameworkcode"); $cache->clear_from_cache("MarcCodedFields-$frameworkcode");
$op = 'list'; $op = 'list';
@ -110,7 +109,6 @@ if ( $op eq 'add_form' ) {
} }
$cache->clear_from_cache("MarcStructure-0-$frameworkcode"); $cache->clear_from_cache("MarcStructure-0-$frameworkcode");
$cache->clear_from_cache("MarcStructure-1-$frameworkcode"); $cache->clear_from_cache("MarcStructure-1-$frameworkcode");
$cache->clear_from_cache("default_value_for_mod_marc-");
$cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode"); $cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode");
$cache->clear_from_cache("MarcCodedFields-$frameworkcode"); $cache->clear_from_cache("MarcCodedFields-$frameworkcode");
$op = 'list'; $op = 'list';

View file

@ -66,9 +66,7 @@ if( $input->param('add_field') && $input->request_method eq 'POST' ) {
# Clear the cache when needed # Clear the cache when needed
unless( $no_upd ) { unless( $no_upd ) {
for( qw| default_value_for_mod_marc- MarcSubfieldStructure- | ) { $cache->clear_from_cache("MarcSubfieldStructure-");
$cache->clear_from_cache($_);
}
} }
# Build/Show the form # Build/Show the form

View file

@ -297,7 +297,6 @@ elsif ( $op eq 'add_validate' ) {
} }
$cache->clear_from_cache("MarcStructure-0-$frameworkcode"); $cache->clear_from_cache("MarcStructure-0-$frameworkcode");
$cache->clear_from_cache("MarcStructure-1-$frameworkcode"); $cache->clear_from_cache("MarcStructure-1-$frameworkcode");
$cache->clear_from_cache("default_value_for_mod_marc-");
$cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode"); $cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode");
$cache->clear_from_cache("MarcCodedFields-$frameworkcode"); $cache->clear_from_cache("MarcCodedFields-$frameworkcode");
@ -336,7 +335,6 @@ elsif ( $op eq 'delete_confirmed' ) {
$cache->clear_from_cache("MarcStructure-0-$frameworkcode"); $cache->clear_from_cache("MarcStructure-0-$frameworkcode");
$cache->clear_from_cache("MarcStructure-1-$frameworkcode"); $cache->clear_from_cache("MarcStructure-1-$frameworkcode");
$cache->clear_from_cache("default_value_for_mod_marc-");
$cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode"); $cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode");
$cache->clear_from_cache("MarcCodedFields-$frameworkcode"); $cache->clear_from_cache("MarcCodedFields-$frameworkcode");
print $input->redirect("/cgi-bin/koha/admin/marc_subfields_structure.pl?tagfield=$tagfield&amp;frameworkcode=$frameworkcode"); print $input->redirect("/cgi-bin/koha/admin/marc_subfields_structure.pl?tagfield=$tagfield&amp;frameworkcode=$frameworkcode");

View file

@ -153,7 +153,6 @@ if ($op eq 'add_form') {
} }
$cache->clear_from_cache("MarcStructure-0-$frameworkcode"); $cache->clear_from_cache("MarcStructure-0-$frameworkcode");
$cache->clear_from_cache("MarcStructure-1-$frameworkcode"); $cache->clear_from_cache("MarcStructure-1-$frameworkcode");
$cache->clear_from_cache("default_value_for_mod_marc-");
$cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode"); $cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode");
$cache->clear_from_cache("MarcCodedFields-$frameworkcode"); $cache->clear_from_cache("MarcCodedFields-$frameworkcode");
print $input->redirect("/cgi-bin/koha/admin/marctagstructure.pl?searchfield=$tagfield&frameworkcode=$frameworkcode"); print $input->redirect("/cgi-bin/koha/admin/marctagstructure.pl?searchfield=$tagfield&frameworkcode=$frameworkcode");
@ -179,7 +178,6 @@ if ($op eq 'add_form') {
$sth2->execute($searchfield, $frameworkcode); $sth2->execute($searchfield, $frameworkcode);
$cache->clear_from_cache("MarcStructure-0-$frameworkcode"); $cache->clear_from_cache("MarcStructure-0-$frameworkcode");
$cache->clear_from_cache("MarcStructure-1-$frameworkcode"); $cache->clear_from_cache("MarcStructure-1-$frameworkcode");
$cache->clear_from_cache("default_value_for_mod_marc-");
$cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode"); $cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode");
$cache->clear_from_cache("MarcCodedFields-$frameworkcode"); $cache->clear_from_cache("MarcCodedFields-$frameworkcode");
$template->param( searchfield => $searchfield ); $template->param( searchfield => $searchfield );

View file

@ -15156,7 +15156,6 @@ if( CheckVersion( $DBversion ) ) {
for my $frameworkcode (@frameworkcodes) { for my $frameworkcode (@frameworkcodes) {
Koha::Caches->get_instance->clear_from_cache("MarcSubfieldStructure-$frameworkcode"); Koha::Caches->get_instance->clear_from_cache("MarcSubfieldStructure-$frameworkcode");
} }
Koha::Caches->get_instance->clear_from_cache("default_value_for_mod_marc-");
} }
SetVersion( $DBversion ); SetVersion( $DBversion );

View file

@ -541,7 +541,6 @@ subtest 'SearchItems test' => sub {
my $cache = Koha::Caches->get_instance(); my $cache = Koha::Caches->get_instance();
$cache->clear_from_cache("MarcStructure-0-$frameworkcode"); $cache->clear_from_cache("MarcStructure-0-$frameworkcode");
$cache->clear_from_cache("MarcStructure-1-$frameworkcode"); $cache->clear_from_cache("MarcStructure-1-$frameworkcode");
$cache->clear_from_cache("default_value_for_mod_marc-");
$cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode"); $cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode");
my $item3_record = MARC::Record->new; my $item3_record = MARC::Record->new;
@ -572,7 +571,6 @@ subtest 'SearchItems test' => sub {
# Clear cache # Clear cache
$cache->clear_from_cache("MarcStructure-0-$frameworkcode"); $cache->clear_from_cache("MarcStructure-0-$frameworkcode");
$cache->clear_from_cache("MarcStructure-1-$frameworkcode"); $cache->clear_from_cache("MarcStructure-1-$frameworkcode");
$cache->clear_from_cache("default_value_for_mod_marc-");
$cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode"); $cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode");
ModItemFromMarc($item3_record, $biblio->biblionumber, $item3_itemnumber); ModItemFromMarc($item3_record, $biblio->biblionumber, $item3_itemnumber);

View file

@ -42,7 +42,6 @@ $dbh->do(qq|
my $cache = Koha::Caches->get_instance(); my $cache = Koha::Caches->get_instance();
$cache->clear_from_cache("MarcStructure-0-$frameworkcode"); $cache->clear_from_cache("MarcStructure-0-$frameworkcode");
$cache->clear_from_cache("MarcStructure-1-$frameworkcode"); $cache->clear_from_cache("MarcStructure-1-$frameworkcode");
$cache->clear_from_cache("default_value_for_mod_marc-");
$cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode"); $cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode");
my $record = MARC::Record->new(); my $record = MARC::Record->new();
@ -341,6 +340,5 @@ is( $schema->resultset('ActionLog')->count(), $actions_nb, q|ToggleNewStatus: no
$cache = Koha::Caches->get_instance(); $cache = Koha::Caches->get_instance();
$cache->clear_from_cache("MarcStructure-0-$frameworkcode"); $cache->clear_from_cache("MarcStructure-0-$frameworkcode");
$cache->clear_from_cache("MarcStructure-1-$frameworkcode"); $cache->clear_from_cache("MarcStructure-1-$frameworkcode");
$cache->clear_from_cache("default_value_for_mod_marc-");
$cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode"); $cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode");
$schema->storage->txn_rollback; $schema->storage->txn_rollback;

View file

@ -715,7 +715,6 @@ subtest 'get_marc_notes() MARC21 tests' => sub {
my $cache = Koha::Caches->get_instance; my $cache = Koha::Caches->get_instance;
$cache->clear_from_cache("MarcStructure-0-"); $cache->clear_from_cache("MarcStructure-0-");
$cache->clear_from_cache("MarcStructure-1-"); $cache->clear_from_cache("MarcStructure-1-");
$cache->clear_from_cache("default_value_for_mod_marc-");
$cache->clear_from_cache("MarcSubfieldStructure-"); $cache->clear_from_cache("MarcSubfieldStructure-");
C4::Biblio::ModBiblio( $record, $biblio->biblionumber ); C4::Biblio::ModBiblio( $record, $biblio->biblionumber );
@ -740,7 +739,6 @@ subtest 'get_marc_notes() MARC21 tests' => sub {
$cache->clear_from_cache("MarcStructure-0-"); $cache->clear_from_cache("MarcStructure-0-");
$cache->clear_from_cache("MarcStructure-1-"); $cache->clear_from_cache("MarcStructure-1-");
$cache->clear_from_cache("default_value_for_mod_marc-");
$cache->clear_from_cache("MarcSubfieldStructure-"); $cache->clear_from_cache("MarcSubfieldStructure-");
$schema->storage->txn_rollback; $schema->storage->txn_rollback;

View file

@ -1092,7 +1092,6 @@ subtest 'columns_to_str' => sub {
my $cache = Koha::Caches->get_instance(); my $cache = Koha::Caches->get_instance();
$cache->clear_from_cache("MarcStructure-0-"); $cache->clear_from_cache("MarcStructure-0-");
$cache->clear_from_cache("MarcStructure-1-"); $cache->clear_from_cache("MarcStructure-1-");
$cache->clear_from_cache("default_value_for_mod_marc-");
$cache->clear_from_cache("MarcSubfieldStructure-"); $cache->clear_from_cache("MarcSubfieldStructure-");
# Creating subfields 'é', 'è' that are not linked with a kohafield # Creating subfields 'é', 'è' that are not linked with a kohafield
@ -1171,7 +1170,6 @@ subtest 'columns_to_str' => sub {
$cache->clear_from_cache("MarcStructure-0-"); $cache->clear_from_cache("MarcStructure-0-");
$cache->clear_from_cache("MarcStructure-1-"); $cache->clear_from_cache("MarcStructure-1-");
$cache->clear_from_cache("default_value_for_mod_marc-");
$cache->clear_from_cache("MarcSubfieldStructure-"); $cache->clear_from_cache("MarcSubfieldStructure-");
$schema->storage->txn_rollback; $schema->storage->txn_rollback;

View file

@ -38,7 +38,6 @@ my $item = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }
my $cache = Koha::Caches->get_instance; my $cache = Koha::Caches->get_instance;
$cache->clear_from_cache("MarcStructure-0-"); $cache->clear_from_cache("MarcStructure-0-");
$cache->clear_from_cache("MarcStructure-1-"); $cache->clear_from_cache("MarcStructure-1-");
$cache->clear_from_cache("default_value_for_mod_marc-");
$cache->clear_from_cache("MarcSubfieldStructure-"); $cache->clear_from_cache("MarcSubfieldStructure-");
# 952 $x $é $y are not linked with a kohafield # 952 $x $é $y are not linked with a kohafield

View file

@ -36,7 +36,6 @@ my $builder = t::lib::TestBuilder->new;
my $cache = Koha::Caches->get_instance(); my $cache = Koha::Caches->get_instance();
$cache->clear_from_cache("MarcStructure-0-"); $cache->clear_from_cache("MarcStructure-0-");
$cache->clear_from_cache("MarcStructure-1-"); $cache->clear_from_cache("MarcStructure-1-");
$cache->clear_from_cache("default_value_for_mod_marc-");
$cache->clear_from_cache("MarcSubfieldStructure-"); $cache->clear_from_cache("MarcSubfieldStructure-");
# 952 $x $é are not linked with a kohafield # 952 $x $é are not linked with a kohafield
@ -350,7 +349,6 @@ subtest 'Fix subfill_with_default_values - no biblionumber passed' => sub {
$cache->clear_from_cache("MarcStructure-0-"); $cache->clear_from_cache("MarcStructure-0-");
$cache->clear_from_cache("MarcStructure-1-"); $cache->clear_from_cache("MarcStructure-1-");
$cache->clear_from_cache("default_value_for_mod_marc-");
$cache->clear_from_cache("MarcSubfieldStructure-"); $cache->clear_from_cache("MarcSubfieldStructure-");
sub setup_mss { sub setup_mss {

View file

@ -66,7 +66,6 @@ $dbh->do("update marc_subfield_structure set kohafield='biblioitems.agerestricti
my $cache = Koha::Caches->get_instance; my $cache = Koha::Caches->get_instance;
$cache->clear_from_cache("MarcStructure-0-$frameworkcode"); $cache->clear_from_cache("MarcStructure-0-$frameworkcode");
$cache->clear_from_cache("MarcStructure-1-$frameworkcode"); $cache->clear_from_cache("MarcStructure-1-$frameworkcode");
$cache->clear_from_cache("default_value_for_mod_marc-");
$cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode"); $cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode");
## Setup Test ## Setup Test
@ -788,7 +787,6 @@ $dbh->do('DELETE FROM reserves', undef, ($bibnum));
$cache->clear_from_cache("MarcStructure-0-$frameworkcode"); $cache->clear_from_cache("MarcStructure-0-$frameworkcode");
$cache->clear_from_cache("MarcStructure-1-$frameworkcode"); $cache->clear_from_cache("MarcStructure-1-$frameworkcode");
$cache->clear_from_cache("default_value_for_mod_marc-");
$cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode"); $cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode");
subtest '_koha_notify_reserve() tests' => sub { subtest '_koha_notify_reserve() tests' => sub {