Bugzilla – Attachment 125586 Details for
Bug 25429
`cleanup_database.pl` should remove resolved claims returned after X days
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25429: Use filter_by_last_update
Bug-25429-Use-filterbylastupdate.patch (text/plain), 1.51 KB, created by
Marcel de Rooy
on 2021-10-01 09:02:49 UTC
(
hide
)
Description:
Bug 25429: Use filter_by_last_update
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2021-10-01 09:02:49 UTC
Size:
1.51 KB
patch
obsolete
>From 0d2c2a359e7c21538af34bd5c2f16b2bc72fcc12 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 6 Apr 2021 09:16:52 -0400 >Subject: [PATCH] Bug 25429: Use filter_by_last_update >Content-Type: text/plain; charset=utf-8 > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > misc/cronjobs/cleanup_database.pl | 20 ++++++++++++++------ > 1 file changed, 14 insertions(+), 6 deletions(-) > >diff --git a/misc/cronjobs/cleanup_database.pl b/misc/cronjobs/cleanup_database.pl >index f29c7a76a7..0a4ab9b32f 100755 >--- a/misc/cronjobs/cleanup_database.pl >+++ b/misc/cronjobs/cleanup_database.pl >@@ -530,14 +530,22 @@ if ($pStatistics) { > > if ($return_claims) { > print "Purging return claims older than $return_claims days.\n" if $verbose; >- $sth = $dbh->prepare( >- q{ >- DELETE FROM return_claims >- WHERE resolved_on < DATE_SUB(CURDATE(), INTERVAL ? DAY) >+ >+ $return_claims = Koha::Checkouts::ReturnClaims->filter_by_last_update( >+ { >+ timestamp_column_name => 'resolved_on', >+ days => $return_claims > } > ); >- $sth->execute($return_claims); >- print "Done with purging return claims.\n" if $verbose; >+ >+ my $count = $return_claims->count; >+ $return_claims->delete if $confirm; >+ >+ if ($verbose) { >+ say $confirm >+ ? sprintf "Done with purging %d resolved return claims.", $count >+ : sprintf "%d resolved return claims would have been purged.", $count; >+ } > } > > if ($pDeletedCatalog) { >-- >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 25429
:
104611
|
104612
|
104798
|
114601
|
114602
|
115042
|
115086
|
115087
|
115088
|
115089
|
115090
|
115907
|
115908
|
118880
|
118881
|
119219
|
120927
|
120928
|
120929
|
120930
|
125584
|
125585
| 125586 |
125587
|
125588