Bugzilla – Attachment 104713 Details for
Bug 25457
The ViewPolicy filter should cache the MARC framework structure
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25457: Make ViewPolicy cache MARC frameworks
Bug-25457-Make-ViewPolicy-cache-MARC-frameworks.patch (text/plain), 1.64 KB, created by
Tomás Cohen Arazi (tcohen)
on 2020-05-11 18:50:02 UTC
(
hide
)
Description:
Bug 25457: Make ViewPolicy cache MARC frameworks
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2020-05-11 18:50:02 UTC
Size:
1.64 KB
patch
obsolete
>From 18f71c897ccd08a5fd2c5e7aef1e8db7421f8fa6 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 11 May 2020 15:36:53 -0300 >Subject: [PATCH] Bug 25457: Make ViewPolicy cache MARC frameworks > >This patch implements an implicit cache of the calculated MARC subfield >structures on each use of the filter. Moreover, if different frameworks >are set between calls (using $processor->options) all of them are >cached. > >To test: >1. Apply the tests patch >2. Run: > $ kshell > k$ prove t/db_dependent/Filter_MARC_ViewPolicy.t >=> FAIL: The ViewPolicy filter doesn't cache anything >3. Apply this patch >4. Repeat 2 >=> SUCCESS: Tests pass! >5. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/Filter/MARC/ViewPolicy.pm | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > >diff --git a/Koha/Filter/MARC/ViewPolicy.pm b/Koha/Filter/MARC/ViewPolicy.pm >index a963e3f129..4d7adfdf67 100644 >--- a/Koha/Filter/MARC/ViewPolicy.pm >+++ b/Koha/Filter/MARC/ViewPolicy.pm >@@ -86,7 +86,11 @@ sub filter { > my $result = $current_record; > my $hide = _should_hide_on_interface(); > >- my $marcsubfieldstructure = GetMarcStructure( 0, $frameworkcode, { unsafe => 1 } ); >+ unless ( exists $self->{_cached_frameworks}->{$frameworkcode} ) { >+ $self->{_cached_frameworks}->{$frameworkcode} = GetMarcStructure( 0, $frameworkcode, { unsafe => 1 } ); >+ } >+ >+ my $marcsubfieldstructure = $self->{_cached_frameworks}->{$frameworkcode}; > > #if ($marcsubfieldstructure->{'000'}->{'@'}->{hidden}>0) { > # LDR field is excluded from $current_record->fields(). >-- >2.26.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 25457
:
104712
|
104713
|
104836
|
104837