Bugzilla – Attachment 180661 Details for
Bug 20551
Add option for including deleted records in export_records.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20551: Cache resultset instead of passing to sub
Bug-20551-Cache-resultset-instead-of-passing-to-su.patch (text/plain), 2.22 KB, created by
Andrew Fuerste-Henry
on 2025-04-04 16:14:16 UTC
(
hide
)
Description:
Bug 20551: Cache resultset instead of passing to sub
Filename:
MIME Type:
Creator:
Andrew Fuerste-Henry
Created:
2025-04-04 16:14:16 UTC
Size:
2.22 KB
patch
obsolete
>From 21d260a0770f198723630a72257d7ce92cd8b93e Mon Sep 17 00:00:00 2001 >From: David Gustafsson <david.gustafsson@ub.gu.se> >Date: Tue, 25 Feb 2025 14:26:33 +0100 >Subject: [PATCH] Bug 20551: Cache resultset instead of passing to sub > >Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com> >--- > Koha/Exporter/Record.pm | 15 +++++++++------ > 1 file changed, 9 insertions(+), 6 deletions(-) > >diff --git a/Koha/Exporter/Record.pm b/Koha/Exporter/Record.pm >index 29bd81105a..8edcbb3fc9 100644 >--- a/Koha/Exporter/Record.pm >+++ b/Koha/Exporter/Record.pm >@@ -123,9 +123,14 @@ sub _get_deleted_biblio_for_export { > my ($params) = @_; > my $biblionumber = $params->{biblionumber}; > >- # Creating schema is expensive, allow caller to >- # pass it so don't have to recreate for each call >- my $resultset = $params->{resultset} || Koha::Database->new()->schema()->resultset('DeletedbiblioMetadata'); >+ # Creating schema is expensive, so we cache it >+ my $memory_cache = Koha::Cache::Memory::Lite->get_instance(); >+ my $resultset = $memory_cache->get_from_cache('_get_deleted_biblio_for_export:resultset'); >+ unless ($resultset) { >+ $resultset = Koha::Database->new()->schema()->resultset('DeletedbiblioMetadata'); >+ $memory_cache->set_in_cache('_get_deleted_biblio_for_export:resultset', $resultset); >+ } >+ > my $marc_flavour = C4::Context->preference('marcflavour'); > my $biblio_metadata = $resultset->find( > { >@@ -234,7 +239,6 @@ sub export { > if ( $format eq 'xml' || $format eq 'iso2709' ) { > my @record_ids = reverse @{$record_ids}; > my @deleted_record_ids = reverse @{$deleted_record_ids}; >- my $deleted_resultset = Koha::Database->new()->schema()->resultset('DeletedbiblioMetadata'); > > my $records_iterator = sub { > if (my $record_id = pop(@record_ids)) { >@@ -245,8 +249,7 @@ sub export { > { > %{$params}, > record_type => 'deleted_bibs', >- record_id => $deleted_record_id, >- resultset => $deleted_resultset >+ record_id => $deleted_record_id > } > ); > } >-- >2.39.5
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 20551
:
73916
|
73923
|
75113
|
82843
|
82914
|
82918
|
90184
|
90190
|
90220
|
93619
|
93620
|
93621
|
105403
|
116408
|
116409
|
116410
|
116411
|
123099
|
123101
|
123102
|
125211
|
125212
|
125213
|
125214
|
125215
|
125216
|
128895
|
128896
|
128897
|
128898
|
128899
|
128900
|
132936
|
132937
|
176623
|
176624
|
176625
|
176626
|
176627
|
176628
|
176629
|
176630
|
176631
|
177536
|
178343
|
178344
|
178345
|
178346
|
178347
|
178348
|
178349
|
178350
|
178351
|
178352
|
178353
|
178378
|
178379
|
178575
|
178617
|
178618
|
178619
|
178679
|
178680
|
178681
|
178682
|
179748
|
179749
|
180648
|
180649
|
180650
|
180651
|
180652
|
180653
|
180654
|
180655
|
180656
|
180657
|
180658
|
180659
|
180660
| 180661 |
180662
|
180663
|
180664
|
180665