Bugzilla – Attachment 106330 Details for
Bug 24153
Add a confirm flag to the cleanup_database.pl cronjob
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24153: Make sure $count will not be reused for another purpose
Bug-24153-Make-sure-count-will-not-be-reused-for-a.patch (text/plain), 3.11 KB, created by
Jonathan Druart
on 2020-06-26 11:01:06 UTC
(
hide
)
Description:
Bug 24153: Make sure $count will not be reused for another purpose
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-06-26 11:01:06 UTC
Size:
3.11 KB
patch
obsolete
>From bdaa3ab861b10e81bbb89f28a097d20ca4e98de9 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 24 Jun 2020 16:11:21 +0200 >Subject: [PATCH] Bug 24153: Make sure $count will not be reused for another > purpose > >The $count variable should be defined per block and set to 0 to avoid >confusion. >--- > misc/cronjobs/cleanup_database.pl | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > >diff --git a/misc/cronjobs/cleanup_database.pl b/misc/cronjobs/cleanup_database.pl >index 4bc3a07a1f..24be963c8e 100755 >--- a/misc/cronjobs/cleanup_database.pl >+++ b/misc/cronjobs/cleanup_database.pl >@@ -229,7 +229,6 @@ cronlogaction() unless $confirm; > my $dbh = C4::Context->dbh(); > my $sth; > my $sth2; >-my $count; > > if ( $sessions && !$sess_days ) { > if ($verbose) { >@@ -254,7 +253,7 @@ elsif ( $sessions && $sess_days > 0 ) { > } > > if ($zebraqueue_days) { >- $count = 0; >+ my $count = 0; > print "Zebraqueue purge triggered for $zebraqueue_days days.\n" if $verbose; > $sth = $dbh->prepare( > q{ >@@ -280,6 +279,7 @@ if ($zebraqueue_days) { > } > > if ($mail) { >+ my $count = 0; > print "Mail queue purge triggered for $mail days.\n" if $verbose; > $count = 0; > $sth = $dbh->prepare( >@@ -362,7 +362,7 @@ if ($pListShareInvites) { > > if ($pDebarments) { > print "Expired patrons restrictions purge triggered for $pDebarments days.\n" if $verbose; >- $count = PurgeDebarments($pDebarments, $confirm); >+ my $count = PurgeDebarments($pDebarments, $confirm); > if ( $verbose ) { > say $confirm ? "$count restrictions were deleted." : "$count restrictions would have been deleted"; > say "Done with restrictions purge."; >@@ -371,7 +371,7 @@ if ($pDebarments) { > > if($allDebarments) { > print "All expired patrons restrictions purge triggered.\n" if $verbose; >- $count = PurgeDebarments(0, $confirm); >+ my $count = PurgeDebarments(0, $confirm); > if ( $verbose ) { > say $confirm ? "$count restrictions were deleted." : "$count restrictions would have been deleted"; > say "Done with all restrictions purge."; >@@ -380,7 +380,7 @@ if($allDebarments) { > > # Handle unsubscribe requests from GDPR consent form, depends on UnsubscribeReflectionDelay preference > my $unsubscribed_patrons = Koha::Patrons->search_unsubscribed; >-$count = $unsubscribed_patrons->count; >+my $count = $unsubscribed_patrons->count; > $unsubscribed_patrons->lock( { expire => 1, remove => 1 } ) if $confirm; > say $confirm ? sprintf("Locked %d patrons", $count) : sprintf("%d patrons would have been locked", $count) if $verbose; > >@@ -588,7 +588,7 @@ sub RemoveOldSessions { > $sth->execute or die $dbh->errstr; > $sth->bind_columns( \$id, \$a_session ); > $sth2 = $dbh->prepare(q{ DELETE FROM sessions WHERE id=? }); >- $count = 0; >+ my $count = 0; > > while ( $sth->fetch ) { > $lasttime = 0; >@@ -650,7 +650,7 @@ sub PurgeZ3950 { > sub PurgeDebarments { > require Koha::Patron::Debarments; > my ( $days, $doit ) = @_; >- $count = 0; >+ my $count = 0; > $sth = $dbh->prepare( > q{ > SELECT borrower_debarment_id >-- >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 24153
:
95980
|
97256
|
101300
|
106197
|
106252
|
106253
|
106254
|
106327
|
106328
|
106329
|
106330
|
106331
|
106332
|
106333
|
106334
|
106335
|
106336
|
106465
|
106466
|
106467
|
106468
|
106469
|
106470