Bugzilla – Attachment 99499 Details for
Bug 24114
Remove warn statements from Koha::Patrons
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24114: Remove warn statements from Koha::Patrons
Bug-24114-Remove-warn-statements-from-KohaPatrons.patch (text/plain), 4.50 KB, created by
Martin Renvoize (ashimema)
on 2020-02-24 12:22:09 UTC
(
hide
)
Description:
Bug 24114: Remove warn statements from Koha::Patrons
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-02-24 12:22:09 UTC
Size:
4.50 KB
patch
obsolete
>From c7d8dd86088c8326d0a4679d6d8413e666d9f1df Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 26 Nov 2019 11:11:35 +0100 >Subject: [PATCH] Bug 24114: Remove warn statements from Koha::Patrons > >The warn must be done in the cronjob. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Followed this test plan (with two follow-ups applied): >[1] Prefs: UnsubscribeReflectionDelay=1, PatronAnonymizeDelay=2, PatronRemovalDelay=3, FailedLoginAttempts was undef >[2] Pick borrower and set expiry to NOW-2, and lock him (login_attempts=-1) Could be achieved too by settings FailedLoginAttempts and trying wrong passwords. Run cleanup job: > Locked 0 patrons > Anonymized 1 patrons > Deleted 0 patrons >[3] Pick borrower, set expiry to NOW-3. Run cleanup job: > Locked 0 patrons > Anonymized 0 patrons > Deleted 1 patrons > >Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Patrons.pm | 17 ++++------------- > misc/cronjobs/cleanup_database.pl | 20 ++++++++++++++++---- > 2 files changed, 20 insertions(+), 17 deletions(-) > >diff --git a/Koha/Patrons.pm b/Koha/Patrons.pm >index f4ca8456a6..22574923d6 100644 >--- a/Koha/Patrons.pm >+++ b/Koha/Patrons.pm >@@ -202,7 +202,7 @@ sub anonymise_issue_history { > > =head3 delete > >- Koha::Patrons->search({ some filters here })->delete({ move => 1, verbose => 1 }); >+ Koha::Patrons->search({ some filters here })->delete({ move => 1 }); > > Delete passed set of patron objects. > Wrapper for Koha::Patron->delete. (We do not want to bypass Koha::Patron >@@ -229,7 +229,6 @@ sub delete { > > $patrons_deleted++; > } >- warn "Deleted $count patrons\n" if $params->{verbose}; > }, $self, $params ); > return $patrons_deleted; > } >@@ -326,10 +325,9 @@ sub search_anonymized { > > =head3 lock > >- Koha::Patrons->search({ some filters })->lock({ expire => 1, remove => 1, verbose => 1 }) >+ Koha::Patrons->search({ some filters })->lock({ expire => 1, remove => 1 }) > > Lock the passed set of patron objects. Optionally expire and remove holds. >- Optional verbose flag is used in cron job. > Wrapper around Koha::Patron->lock. > > =cut >@@ -340,30 +338,23 @@ sub lock { > while( my $patron = $self->next ) { > $patron->lock($params); > } >- if( $params->{verbose} ) { >- warn "Locked $count patrons\n"; >- } > } > > =head3 anonymize > >- Koha::Patrons->search({ some filters })->anonymize({ verbose => 1 }); >+ Koha::Patrons->search({ some filters })->anonymize(); > > Anonymize passed set of patron objects. >- Optional verbose flag is used in cron job. > Wrapper around Koha::Patron->anonymize. > > =cut > > sub anonymize { >- my ( $self, $params ) = @_; >+ my ( $self ) = @_; > my $count = $self->count; > while( my $patron = $self->next ) { > $patron->anonymize; > } >- if( $params->{verbose} ) { >- warn "Anonymized $count patrons\n"; >- } > } > > =head3 search_patrons_to_update_category >diff --git a/misc/cronjobs/cleanup_database.pl b/misc/cronjobs/cleanup_database.pl >index b0f60b2cc3..7ca7b33177 100755 >--- a/misc/cronjobs/cleanup_database.pl >+++ b/misc/cronjobs/cleanup_database.pl >@@ -331,12 +331,24 @@ if($allDebarments) { > } > > # Handle unsubscribe requests from GDPR consent form, depends on UnsubscribeReflectionDelay preference >-Koha::Patrons->search_unsubscribed->lock({ expire => 1, remove => 1, verbose => $verbose }); >+my $unsubscribed_patrons = Koha::Patrons->search_unsubscribed; >+$unsubscribed_patrons->lock( { expire => 1, remove => 1 } ); >+say sprintf "Locked %d patrons", $unsubscribed_patrons->count if $verbose; >+ > # Anonymize patron data, depending on PatronAnonymizeDelay >-Koha::Patrons->search_anonymize_candidates({ locked => 1 })->anonymize({ verbose => $verbose }); >+my $anonymize_candidates = Koha::Patrons->search_anonymize_candidates( { locked => 1 } ); >+$anonymize_candidates->anonymize; >+say sprintf "Anonymized %s patrons", $anonymize_candidates->count if $verbose; >+ > # Remove patron data, depending on PatronRemovalDelay (will raise an exception if problem encountered >-eval { Koha::Patrons->search_anonymized->delete({ move => 1, verbose => $verbose }) }; >-warn $@ if $@; >+my $anonymized_patrons = Koha::Patrons->search_anonymized; >+$anonymized_patrons->delete( { move => 1 } ); >+if ($@) { >+ warn $@; >+} >+elsif ($verbose) { >+ say sprintf "Deleted %d patrons", $anonymized_patrons->count; >+} > > if( $pExpSelfReg ) { > DeleteExpiredSelfRegs(); >-- >2.20.1
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 24114
:
95814
|
95874
|
95875
|
95876
|
99446
|
99447
|
99448
|
99449
|
99450
| 99499 |
99500
|
99501