Bugzilla – Attachment 148143 Details for
Bug 33214
Make sure cache is cleared properly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33214: (follow-up) Consistency on key names
Bug-33214-follow-up-Consistency-on-key-names.patch (text/plain), 3.35 KB, created by
Tomás Cohen Arazi
on 2023-03-13 19:53:55 UTC
(
hide
)
Description:
Bug 33214: (follow-up) Consistency on key names
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi
Created:
2023-03-13 19:53:55 UTC
Size:
3.35 KB
patch
obsolete
>From 52315d60f38165195b86b49c771d1861084dc9dd Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 13 Mar 2023 16:42:26 -0300 >Subject: [PATCH] Bug 33214: (follow-up) Consistency on key names > >This patch makes GetAuthorisedValueDesc used cache keys match what we >discussed on the bug, which seems to have been lost on some rebase and >highlighted by failing tests. > >I also add some more cache flushes. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > C4/Biblio.pm | 6 +++--- > t/db_dependent/Koha/Filter/ExpandCodedFields.t | 5 +++++ > t/db_dependent/Koha/Item.t | 1 + > 3 files changed, 9 insertions(+), 3 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index e90eb117b71..1af5e126969 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -1385,7 +1385,7 @@ sub GetAuthorisedValueDesc { > > #---- branch > if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) { >- $cache_key = "LibraryNames"; >+ $cache_key = "libraries:name"; > my $libraries = $cache->get_from_cache( $cache_key, { unsafe => 1 } ); > if ( !$libraries ) { > $libraries = { >@@ -1403,7 +1403,7 @@ sub GetAuthorisedValueDesc { > if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "itemtypes" ) { > my $lang = C4::Languages::getlanguage; > $lang //= 'en'; >- $cache_key = $lang . 'ItemTypeDescriptions'; >+ $cache_key = 'itemtype:description:' . $lang; > my $itypes = $cache->get_from_cache( $cache_key, { unsafe => 1 } ); > if ( !$itypes ) { > $itypes = >@@ -1435,7 +1435,7 @@ sub GetAuthorisedValueDesc { > > my $dbh = C4::Context->dbh; > if ( $category ne "" ) { >- $cache_key = "AVDescriptions-" . $category; >+ $cache_key = "AV_descriptions:" . $category; > my $av_descriptions = $cache->get_from_cache( $cache_key, { unsafe => 1 } ); > if ( !$av_descriptions ) { > $av_descriptions = { >diff --git a/t/db_dependent/Koha/Filter/ExpandCodedFields.t b/t/db_dependent/Koha/Filter/ExpandCodedFields.t >index 04912a4a83f..25df74bfbeb 100755 >--- a/t/db_dependent/Koha/Filter/ExpandCodedFields.t >+++ b/t/db_dependent/Koha/Filter/ExpandCodedFields.t >@@ -73,6 +73,11 @@ subtest 'ExpandCodedFields tests' => sub { > > my $cache = Koha::Caches->get_instance; > $cache->clear_from_cache("MarcCodedFields-"); >+ # Clear GetAuthorisedValueDesc-generated cache >+ $cache->clear_from_cache("libraries:name"); >+ $cache->clear_from_cache("itemtype:description:en"); >+ $cache->clear_from_cache("cn_sources:description"); >+ $cache->clear_from_cache("AV_descriptions:LOST"); > > C4::Biblio::ModBiblio( $record, $biblio->biblionumber ); > $biblio = Koha::Biblios->find( $biblio->biblionumber); >diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t >index bd56d196239..d9252ef3d8f 100755 >--- a/t/db_dependent/Koha/Item.t >+++ b/t/db_dependent/Koha/Item.t >@@ -1463,6 +1463,7 @@ subtest 'strings_map() tests' => sub { > $cache->clear_from_cache("libraries:name"); > $cache->clear_from_cache("itemtype:description:en"); > $cache->clear_from_cache("cn_sources:description"); >+ $cache->clear_from_cache("AV_descriptions:LOST"); > > # Recreating subfields just to be sure tests will be ok > # 1 => av (LOST) >-- >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 33214
:
148132
|
148134
| 148143 |
148144