Bugzilla – Attachment 69999 Details for
Bug 19599
anonymise_issue_history can be very slow on large systems
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19599: Speed anonymise_issue_history up
Bug-19599-Speed-anonymiseissuehistory-up.patch (text/plain), 1.82 KB, created by
Kyle M Hall
on 2017-12-21 11:23:03 UTC
(
hide
)
Description:
Bug 19599: Speed anonymise_issue_history up
Filename:
MIME Type:
Creator:
Kyle M Hall
Created:
2017-12-21 11:23:03 UTC
Size:
1.82 KB
patch
obsolete
>From 824328109f559ca06851a64942ef83356ef119bc Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 9 Nov 2017 10:34:08 -0300 >Subject: [PATCH] Bug 19599: Speed anonymise_issue_history up > >The query generated by anonymise_issue_history is unecessary complex and >can be very slow on large DB. >With this patch we will execute one query per patron instead. > >See patch "Bug 19599: Simplify the query" on the bug report for an >alternative. > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Patrons.pm | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) > >diff --git a/Koha/Patrons.pm b/Koha/Patrons.pm >index 263cec7..fd2b997 100644 >--- a/Koha/Patrons.pm >+++ b/Koha/Patrons.pm >@@ -168,8 +168,9 @@ sub anonymise_issue_history { > # The anonymisation should not fail quietly if AnonymousPatron is not a valid entry > # Set it to undef (NULL) > my $dtf = Koha::Database->new->schema->storage->datetime_parser; >- my $old_issues_to_anonymise = $self->search_related( >- 'old_issues', >+ my $nb_rows = 0; >+ while ( my $patron = $self->next ) { >+ my $old_issues_to_anonymise = $patron->old_checkouts->search( > { > ( > $older_than_date >@@ -178,9 +179,11 @@ sub anonymise_issue_history { > : () > ) > } >- ); >- my $anonymous_patron = C4::Context->preference('AnonymousPatron') || undef; >- $old_issues_to_anonymise->update( { 'old_issues.borrowernumber' => $anonymous_patron } ); >+ ); >+ my $anonymous_patron = C4::Context->preference('AnonymousPatron') || undef; >+ $nb_rows += $old_issues_to_anonymise->update( { 'old_issues.borrowernumber' => $anonymous_patron } ); >+ } >+ return $nb_rows; > } > > =head3 type >-- >2.10.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 19599
:
69052
|
69054
|
69778
|
69860
| 69999