https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35811
Bug ID: 35811
Summary: Adding a new item type does not clear cache (causing
new type to not show properly in OPAC)
Change sponsored?: ---
Product: Koha
Version: master
Hardware: All
OS: All
Status: NEW
Severity: trivial
Priority: P5 - low
Component: Staff interface
Assignee: [email protected]
Reporter: [email protected]
QA Contact: [email protected]
CC: [email protected]
Item type descriptions are cached with cache key of
'itemtype:description:'.$lang, which is used by function
C4::Biblio::GetAuthorisedValueDesc, used for example in OPAC during display of
item's item type in the details view table:
https://github.com/Koha-Community/Koha/blob/3df1cb33c277925b689b1e45c736ea8532bffdff/C4/Biblio.pm#L1434C58-L1434C58
The problem is, when a new item type is added, that cache key isn't flushed,
meaning the new item type won't be displayed in OPAC, an empty field will be
shown instead. Flushing memcached mitigates this issue.
The cache key is cleared here during tests for instance:
https://github.com/Koha-Community/Koha/blob/3df1cb33c277925b689b1e45c736ea8532bffdff/t/db_dependent/Koha/Filter/ExpandCodedFields.t#L71
I suspect the cache flushing should occur in `admin/itemtypes.pl`, after $op
'add_validate'. However, I'm not sure how to get the list of all languages to
purge (and I assume all of them should be purged).
I've found code snippet below, but I'm not sure if this approach would be
acceptable (after adjusting the regex of course), given this gets cache by
`Koha::Cache::Memory::Lite->get_instance` instead of
`Koha::Caches->get_instance`...
my $memory_cache = Koha::Cache::Memory::Lite->get_instance;
for my $k ( $memory_cache->all_keys ) {
$memory_cache->clear_from_cache($k) if $k =~ m{^CircRules:};
}
I've also found this snippet (I see itemtypes.pl calls ->store, so this gets
called too):
https://github.com/Koha-Community/Koha/blob/2ce83fc784ad8bc716bd65f14845141097c72b69/Koha/ItemType.pm#L62C1-L63
It seems to purge only English, which might be why I experienced the issue that
I've experienced.
So the question that prevails then is: how do we purge all the used languages?
--
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/