Bugzilla – Attachment 168922 Details for
Bug 37349
Use cache for authority types when linking bibs to authorities
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37349: Use cache for authority types and remove extra fetch
Bug-37349-Use-cache-for-authority-types-and-remove.patch (text/plain), 2.66 KB, created by
Nick Clemens (kidclamp)
on 2024-07-12 15:58:52 UTC
(
hide
)
Description:
Bug 37349: Use cache for authority types and remove extra fetch
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-07-12 15:58:52 UTC
Size:
2.66 KB
patch
obsolete
>From 5e00fd3def91455429fcd3bd7adc68cdfcaa33ff Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 12 Jul 2024 15:56:45 +0000 >Subject: [PATCH] Bug 37349: Use cache for authority types and remove extra > fetch > >This patch caches the authority types when fetched during linking to avoid grabbing the same type more than once. >Additionally it removes a second call to fetch the same type in some scenarios > >To test: >1 - Apply patch >2 - Enable linking during cataloging/updating records >3 - Edit a record and confirm it is linked ocrrectly >4 - Run the authority linking cron and confirm it works as expected >--- > C4/Biblio.pm | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index d9e43b7dbaa..99804edd903 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -643,6 +643,7 @@ sub LinkBibHeadingsToAuthorities { > my $tagtolink = shift; > my $verbose = shift; > my %results; >+ my $memory_cache = Koha::Cache::Memory::Lite->get_instance(); > if (!$bib) { > carp 'LinkBibHeadingsToAuthorities called on undefined bib record'; > return ( 0, {}); >@@ -684,7 +685,11 @@ sub LinkBibHeadingsToAuthorities { > push(@{$results{'details'}}, { tag => $field->tag(), authid => $authid, status => 'LOCAL_FOUND'}) if $verbose; > } > else { >- my $authority_type = Koha::Authority::Types->find( $heading->auth_type() ); >+ my $authority_type = $memory_cache->get_from_cache( "LinkBibHeadingsToAuthorities:AuthorityType:" . $heading->auth_type() ); >+ unless ( $authority_type ){ >+ $authority_type = Koha::Authority::Types->find( $heading->auth_type() ); >+ $memory_cache->set_in_cache( "LinkBibHeadingsToAuthorities:AuthorityType:" . $ heading->auth_type() ); >+ } > if ( defined $current_link > && (!$allowrelink || C4::Context->preference('LinkerKeepStale')) ) > { >@@ -698,7 +703,6 @@ sub LinkBibHeadingsToAuthorities { > $results{'unlinked'}->{ $heading->display_form() }++; > push(@{$results{'details'}}, { tag => $field->tag(), authid => undef, status => 'MULTIPLE_MATCH', auth_type => $heading->auth_type(), tag_to_report => $authority_type->auth_tag_to_report}) if $verbose; > } elsif ( !$match_count ) { >- my $authority_type = Koha::Authority::Types->find( $heading->auth_type() ); > my $marcrecordauth = MARC::Record->new(); > if ( C4::Context->preference('marcflavour') eq 'MARC21' ) { > $marcrecordauth->leader(' nz a22 o 4500'); >-- >2.39.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 37349
:
168922
|
170142
|
170211
|
170436