From 205d909a56f0170e1abf60bf880315e52f66fd21 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 17 Sep 2020 12:55:53 +0000 Subject: [PATCH] Bug 25265: Rename skip_modzebra_update to skip_record_index Signed-off-by: Bob Bennhoff Signed-off-by: Marcel de Rooy Signed-off-by: Jonathan Druart --- C4/Circulation.pm | 6 +++--- C4/Items.pm | 12 ++++++------ Koha/Item.pm | 6 +++--- cataloguing/additem.pl | 4 ++-- t/db_dependent/Koha/SearchEngine/Indexer.t | 12 ++++++------ tools/batchMod.pl | 4 ++-- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 203370e1a3..716c1db4e0 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -3721,13 +3721,13 @@ sub ReturnLostItem{ LostItem( $itemnumber, $mark_lost_from, $force_mark_returned, [$params] ); The final optional parameter, C<$params>, expected to contain -'skip_modzebra_update' key, which relayed down to Koha::Item/store, +'skip_record_index' key, which relayed down to Koha::Item/store, there it prevents calling of ModZebra index_records, which takes most of the time in batch adds/deletes: index_records better to be called later in C after the whole loop. $params: - skip_modzebra_update => 1|0 + skip_record_index => 1|0 =cut @@ -3783,7 +3783,7 @@ sub LostItem{ #When item is marked lost automatically cancel its outstanding transfers and set items holdingbranch to the transfer source branch (frombranch) if (my ( $datesent,$frombranch,$tobranch ) = GetTransfers($itemnumber)) { - Koha::Items->find($itemnumber)->holdingbranch($frombranch)->store({ skip_modzebra_update => $params->{skip_modzebra_update} }); + Koha::Items->find($itemnumber)->holdingbranch($frombranch)->store({ skip_record_index => $params->{skip_record_index} }); } my $transferdeleted = DeleteTransfer($itemnumber); } diff --git a/C4/Items.pm b/C4/Items.pm index 53951abfc3..9da7f61fc6 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -144,13 +144,13 @@ Given a MARC::Record object containing an embedded item record and a biblionumber, create a new item record. The final optional parameter, C<$params>, expected to contain -'skip_modzebra_update' key, which relayed down to Koha::Item/store, +'skip_record_index' key, which relayed down to Koha::Item/store, there it prevents calling of index_records, which takes most of the time in batch adds/deletes: index_records to be called later in C after the whole loop. $params: - skip_modzebra_update => 1|0 + skip_record_index => 1|0 =cut @@ -174,7 +174,7 @@ sub AddItemFromMarc { $item_values->{biblionumber} = $biblionumber; $item_values->{cn_source} = delete $item_values->{'items.cn_source'}; # Because of C4::Biblio::_disambiguate $item_values->{cn_sort} = delete $item_values->{'items.cn_sort'}; # Because of C4::Biblio::_disambiguate - my $item = Koha::Item->new( $item_values )->store({ skip_modzebra_update => $params->{skip_modzebra_update} }); + my $item = Koha::Item->new( $item_values )->store({ skip_record_index => $params->{skip_record_index} }); return ( $item->biblionumber, $item->biblioitemnumber, $item->itemnumber ); } @@ -287,13 +287,13 @@ sub AddItemBatchFromMarc { my $item = ModItemFromMarc($item_marc, $biblionumber, $itemnumber[, $params]); The final optional parameter, C<$params>, expected to contain -'skip_modzebra_update' key, which relayed down to Koha::Item/store, +'skip_record_index' key, which relayed down to Koha::Item/store, there it prevents calling of index_records, which takes most of the time in batch adds/deletes: index_records better to be called later in C after the whole loop. $params: - skip_modzebra_update => 1|0 + skip_record_index => 1|0 =cut @@ -327,7 +327,7 @@ sub ModItemFromMarc { $item_object = $item_object->set_or_blank($item); my $unlinked_item_subfields = _get_unlinked_item_subfields( $localitemmarc, $frameworkcode ); $item_object->more_subfields_xml(_get_unlinked_subfields_xml($unlinked_item_subfields)); - $item_object->store({ skip_modzebra_update => $params->{skip_modzebra_update} }); + $item_object->store({ skip_record_index => $params->{skip_record_index} }); return $item_object->unblessed; } diff --git a/Koha/Item.pm b/Koha/Item.pm index 5b2cfa9900..0da3a46f00 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -61,7 +61,7 @@ Koha::Item - Koha Item object class $item->store; -$params can take an optional 'skip_modzebra_update' parameter. +$params can take an optional 'skip_record_index' parameter. If set, the reindexation process will not happen (index_records not called) NOTE: This is a temporary fix to answer a performance issue when lot of items @@ -197,7 +197,7 @@ sub store { my $result = $self->SUPER::store; my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::BIBLIOS_INDEX }); $indexer->index_records( $self->biblionumber, "specialUpdate", "biblioserver" ) - unless $params->{skip_modzebra_update}; + unless $params->{skip_record_index}; $self->get_from_storage->_after_item_action_hooks({ action => $plugin_action }); return $result; @@ -216,7 +216,7 @@ sub delete { my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::BIBLIOS_INDEX }); $indexer->index_records( $self->biblionumber, "specialUpdate", "biblioserver" ) - unless $params->{skip_modzebra_update}; + unless $params->{skip_record_index}; $self->_after_item_action_hooks({ action => 'delete' }); diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 34504c37a6..9f6d59a5fc 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -615,7 +615,7 @@ if ($op eq "additem") { # Adding the item if (!$exist_itemnumber) { my ( $oldbiblionumber, $oldbibnum, $oldbibitemnum ) = - AddItemFromMarc( $record, $biblionumber, { skip_modzebra_update => 1 } ); + AddItemFromMarc( $record, $biblionumber, { skip_record_index => 1 } ); set_item_default_location($oldbibitemnum); # We count the item only if it was really added @@ -705,7 +705,7 @@ if ($op eq "additem") { #------------------------------------------------------------------------------- my $items = Koha::Items->search({ biblionumber => $biblionumber }); while ( my $item = $items->next ) { - $error = $item->safe_delete({ skip_modzebra_update => 1 }); + $error = $item->safe_delete({ skip_record_index => 1 }); next if ref $error eq 'Koha::Item'; # Deleted item is returned if deletion successful push @errors,$error; } diff --git a/t/db_dependent/Koha/SearchEngine/Indexer.t b/t/db_dependent/Koha/SearchEngine/Indexer.t index abcbc9a9cb..4515d69f8d 100755 --- a/t/db_dependent/Koha/SearchEngine/Indexer.t +++ b/t/db_dependent/Koha/SearchEngine/Indexer.t @@ -113,8 +113,8 @@ subtest 'Test indexer calls' => sub { $item2 = $builder->build_sample_item({biblionumber => $biblio->biblionumber}); } [$engine,"Koha::Item",$engine,"Koha::Item"], "index_records is called for $engine when adding an item (Item->store)"; warnings_are{ - $item->store({ skip_modzebra_update => 1 }); - } undef, "index_records is not called for $engine when adding an item (Item->store) if skip_modzebra_update passed"; + $item->store({ skip_record_index => 1 }); + } undef, "index_records is not called for $engine when adding an item (Item->store) if skip_record_index passed"; $builder->build({ source => 'Branchtransfer', @@ -132,15 +132,15 @@ subtest 'Test indexer calls' => sub { datearrived => undef} }); warnings_are{ - LostItem( $item->itemnumber, "tests", undef, { skip_modzebra_update => 1 }); - } undef, "index_records is not called for $engine when calling LostItem and transfer exists if skip_modzebra_update"; + LostItem( $item->itemnumber, "tests", undef, { skip_record_index => 1 }); + } undef, "index_records is not called for $engine when calling LostItem and transfer exists if skip_record_index"; warnings_are{ $item->delete(); } [$engine,"Koha::Item"], "index_records is called for $engine when deleting an item (Item->delete)"; warnings_are{ - $item2->delete({ skip_modzebra_update => 1 }); - } undef, "index_records is not called for $engine when adding an item (Item->store) if skip_modzebra_update passed"; + $item2->delete({ skip_record_index => 1 }); + } undef, "index_records is not called for $engine when adding an item (Item->store) if skip_record_index passed"; warnings_are{ DelBiblio( $biblio->biblionumber ); diff --git a/tools/batchMod.pl b/tools/batchMod.pl index 1d076c2678..53be980888 100755 --- a/tools/batchMod.pl +++ b/tools/batchMod.pl @@ -304,7 +304,7 @@ if ($op eq "action") { $localmarcitem, $itemdata->{biblionumber}, $itemnumber, - { skip_modzebra_update => 1 }, + { skip_record_index => 1 }, ) ) { @@ -312,7 +312,7 @@ if ($op eq "action") { $itemnumber, 'batchmod', undef, - { skip_modzebra_update => 1 } + { skip_record_index => 1 } ) if $item->{itemlost} and not $itemdata->{itemlost}; } -- 2.39.5