Bugzilla – Attachment 135418 Details for
Bug 30848
Introduce Koha::Filter::ExpandCodedFields
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30848: Ensure we flush the cache as necessary
Bug-30848-Ensure-we-flush-the-cache-as-necessary.patch (text/plain), 4.15 KB, created by
Martin Renvoize (ashimema)
on 2022-05-27 10:23:23 UTC
(
hide
)
Description:
Bug 30848: Ensure we flush the cache as necessary
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-05-27 10:23:23 UTC
Size:
4.15 KB
patch
obsolete
>From b022757fcb562a8edd0c35dd571cc75597da16eb Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 27 May 2022 11:22:23 +0100 >Subject: [PATCH] Bug 30848: Ensure we flush the cache as necessary > >--- > Koha/ClassSource.pm | 35 ++++++++++++++++++++++++++++++++++- > Koha/ItemType.pm | 36 ++++++++++++++++++++++++++++++++++++ > Koha/Library.pm | 36 ++++++++++++++++++++++++++++++++++++ > 3 files changed, 106 insertions(+), 1 deletion(-) > >diff --git a/Koha/ClassSource.pm b/Koha/ClassSource.pm >index 3b192ee124..0bd83b6296 100644 >--- a/Koha/ClassSource.pm >+++ b/Koha/ClassSource.pm >@@ -17,7 +17,8 @@ package Koha::ClassSource; > > use Modern::Perl; > >- >+use Koha::BiblioFrameworks; >+use Koha::Caches; > use Koha::Database; > > use base qw(Koha::Object); >@@ -30,8 +31,40 @@ Koha::ClassSource - Koha Classfication Source Object class > > =head2 Class Methods > >+=head3 store >+ >+ClassSource specific store to ensure relevant caches are flushed on change >+ > =cut > >+sub store { >+ my ($self) = @_; >+ >+ my $flush = 0; >+ >+ if ( !$self->in_storage ) { >+ $flush = 1; >+ } >+ else { >+ my $self_from_storage = $self->get_from_storage; >+ $flush = 1 if ( $self_from_storage->description ne $self->description ); >+ } >+ >+ $self = $self->SUPER::store; >+ >+ if ($flush) { >+ my $cache = Koha::Caches->get_instance(); >+ my @frameworks = >+ Koha::BiblioFrameworks->search()->get_column('frameworkcode'); >+ for my $frameworkcode (@frameworks) { >+ my $key = "MarcAVStructure-$frameworkcode"; >+ $cache->clear_from_cache($key); >+ } >+ } >+ >+ return $self; >+} >+ > =head3 _type > > Returns name of corresponding DBIC resultset >diff --git a/Koha/ItemType.pm b/Koha/ItemType.pm >index 4b77433e8e..495b410d7b 100644 >--- a/Koha/ItemType.pm >+++ b/Koha/ItemType.pm >@@ -20,6 +20,8 @@ use Modern::Perl; > > use C4::Koha qw( getitemtypeimagelocation ); > use C4::Languages; >+use Koha::BiblioFrameworks; >+use Koha::Caches; > use Koha::Database; > use Koha::CirculationRules; > use Koha::Localizations; >@@ -36,6 +38,40 @@ Koha::ItemType - Koha Item type Object class > > =cut > >+=head3 store >+ >+ItemType specific store to ensure relevant caches are flushed on change >+ >+=cut >+ >+sub store { >+ my ($self) = @_; >+ >+ my $flush = 0; >+ >+ if ( !$self->in_storage ) { >+ $flush = 1; >+ } >+ else { >+ my $self_from_storage = $self->get_from_storage; >+ $flush = 1 if ( $self_from_storage->description ne $self->description ); >+ } >+ >+ $self = $self->SUPER::store; >+ >+ if ($flush) { >+ my $cache = Koha::Caches->get_instance(); >+ my @frameworks = >+ Koha::BiblioFrameworks->search()->get_column('frameworkcode'); >+ for my $frameworkcode (@frameworks) { >+ my $key = "MarcAVStructure-$frameworkcode"; >+ $cache->clear_from_cache($key); >+ } >+ } >+ >+ return $self; >+} >+ > =head3 image_location > > =cut >diff --git a/Koha/Library.pm b/Koha/Library.pm >index 48e125529b..381237443a 100644 >--- a/Koha/Library.pm >+++ b/Koha/Library.pm >@@ -22,6 +22,8 @@ use Modern::Perl; > > use C4::Context; > >+use Koha::BiblioFrameworks; >+use Koha::Caches; > use Koha::Database; > use Koha::StockRotationStages; > use Koha::SMTP::Servers; >@@ -36,6 +38,40 @@ Koha::Library - Koha Library Object class > > =head2 Class methods > >+=head3 store >+ >+Library specific store to ensure relevant caches are flushed on change >+ >+=cut >+ >+sub store { >+ my ($self) = @_; >+ >+ my $flush = 0; >+ >+ if ( !$self->in_storage ) { >+ $flush = 1; >+ } >+ else { >+ my $self_from_storage = $self->get_from_storage; >+ $flush = 1 if ( $self_from_storage->branchname ne $self->branchname ); >+ } >+ >+ $self = $self->SUPER::store; >+ >+ if ($flush) { >+ my $cache = Koha::Caches->get_instance(); >+ my @frameworks = >+ Koha::BiblioFrameworks->search()->get_column('frameworkcode'); >+ for my $frameworkcode (@frameworks) { >+ my $key = "MarcAVStructure-$frameworkcode"; >+ $cache->clear_from_cache($key); >+ } >+ } >+ >+ return $self; >+} >+ > =head3 stockrotationstages > > my $stages = Koha::Library->stockrotationstages; >-- >2.20.1
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 30848
:
135338
|
135353
|
135363
|
135364
|
135386
|
135387
|
135388
|
135418
|
135421
|
135422
|
135423
|
135424
|
135425
|
135707
|
135708
|
135709
|
135710
|
135711
|
135712
|
135713
|
135714
|
135715
|
135716
|
135717
|
135770
|
136025
|
136026
|
136027
|
136259
|
136260
|
136261
|
136262
|
136774
|
136775
|
136776
|
136777