Bug 16431 - Marc subfield structure should be cached using Koha::Cache
Summary: Marc subfield structure should be cached using Koha::Cache
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
: 16744 (view as bug list)
Depends on: 13074
Blocks: 7172 8089 17201
  Show dependency treegraph
 
Reported: 2016-05-03 13:33 UTC by Jonathan Druart
Modified: 2017-12-07 22:16 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Medium patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 16431: Use Koha::Cache to cache marc subfield structure (24.92 KB, patch)
2016-05-03 13:53 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 16431: Use Koha::Cache to cache marc subfield structure (25.11 KB, patch)
2016-05-10 14:12 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 16431: Use Koha::Cache to cache marc subfield structure (25.17 KB, patch)
2016-06-24 15:33 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2016-05-03 13:33:40 UTC

    
Comment 1 Jonathan Druart 2016-05-03 13:53:04 UTC Comment hidden (obsolete)
Comment 2 Bernardo Gonzalez Kriegel 2016-05-04 16:05:43 UTC
Master is moving fast

fatal: sha1 information is lacking or useless (admin/biblio_framework.pl).
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0001 Bug 16431: Use Koha::Cache to cache marc subfield structure
Comment 3 Bernardo Gonzalez Kriegel 2016-05-04 16:22:30 UTC
Sorry, forgot the dependency.
Comment 4 Tomás Cohen Arazi 2016-05-10 14:12:44 UTC Comment hidden (obsolete)
Comment 5 Kyle M Hall 2016-06-24 15:33:42 UTC
Created attachment 52813 [details] [review]
Bug 16431: Use Koha::Cache to cache marc subfield structure

The marc subfield structure is currently cached using a global variable
of C4::Context. The infos are retrieved every time a new context is
created.
This patch suggests to use Koha::Cache instead.

To achieve this goal, a new subroutine is created
C4::Biblio::GetMarcSubfieldStructure, it will be called from code which
needs to get the marc subfield structure. GetMarcFromKohaField,
GetMarcSubfieldStructureFromKohaField, TransformKohaToMarc and
_get_inverted_marc_field_map are modified accordingly and the cache is cleared
when the table is updated (from the 3 pl scripts modified by this patch).

The caching done in C4::Context (marcfromkohafield) is removed.

Test plan:
Play with the marc subfield structure (in the administration module),
then add and edit records and make sure everything went fine.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Everything works as expected on my functional tests. I'm really happy to see the
patch introduces relevant tests for previously untested functions.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 6 Kyle M Hall 2016-07-08 12:46:03 UTC
Pushed to master for 16.11, thanks Jonathan!
Comment 7 Frédéric Demians 2016-08-01 13:20:52 UTC
Pushed in 16.05. Will be in 16.05.02.
Comment 8 Jonathan Druart 2016-08-31 12:55:49 UTC
*** Bug 16744 has been marked as a duplicate of this bug. ***