Bugzilla – Attachment 158680 Details for
Bug 21214
cleanup_database.pl --mail should let admin choose which letter codes to keep
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug_21214: Change of SQL request in condition $mail with letter_code and code modification
Bug21214-Change-of-SQL-request-in-condition-mail-w.patch (text/plain), 1.82 KB, created by
Lucas Gass (lukeg)
on 2023-11-08 22:06:51 UTC
(
hide
)
Description:
Bug_21214: Change of SQL request in condition $mail with letter_code and code modification
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2023-11-08 22:06:51 UTC
Size:
1.82 KB
patch
obsolete
>From 4d6c2a8433e6f92aa9947984cf43f1f93c454418 Mon Sep 17 00:00:00 2001 >From: Ivan Dziuba <ivan.dziuba@inlibro.com> >Date: Wed, 4 Nov 2020 10:31:31 -0500 >Subject: [PATCH] Bug_21214: Change of SQL request in condition $mail with > letter_code and code modification > >Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> >--- > misc/cronjobs/cleanup_database.pl | 20 ++++++++++---------- > 1 file changed, 10 insertions(+), 10 deletions(-) > >diff --git a/misc/cronjobs/cleanup_database.pl b/misc/cronjobs/cleanup_database.pl >index 3bb02c8d5e7..bfe63da7869 100755 >--- a/misc/cronjobs/cleanup_database.pl >+++ b/misc/cronjobs/cleanup_database.pl >@@ -348,18 +348,18 @@ if ($mail) { > my $count = 0; > print "Mail queue purge triggered for $mail days.\n" if $verbose; > print "Not deleting emails of type $letter_codes.\n" if ($verbose && $letter_codes); >- my $query = q{ >- DELETE FROM message_queue >- WHERE time_queued < date_sub(curdate(), INTERVAL ? DAY) >- AND letter_code NOT IN ( ? ) >- }; >- my $quoted_codes = ''; >+ my (@codes, $quoted_codes); > if ($letter_codes) { >- my @codes = map { "'$_'" } split(',', $letter_codes); >- my $quoted_codes = join(',', @codes); >+ $letter_codes =~ s/ //g; >+ @codes = map { "$_" } split(',', $letter_codes); >+ $quoted_codes = join ",", ("?") x @codes; > } >- $sth = $dbh->prepare($query); >- $sth->execute($mail, $quoted_codes) or die $dbh->errstr; >+ >+ $sth = $dbh->prepare(" >+ DELETE FROM message_queue >+ WHERE time_queued < date_sub(curdate(), INTERVAL ? DAY) >+ AND letter_code NOT IN ( $quoted_codes )"); >+ $sth->execute($mail, @codes) or die $dbh->errstr; > $count = $sth->rows; > $sth->finish; > print "$count messages were deleted from the mail queue.\nDone with message_queue purge.\n" if $verbose; >-- >2.30.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 21214
:
77756
|
77762
|
112992
|
112993
|
112994
|
113002
|
113008
|
113009
|
148622
|
148623
|
148624
|
148625
|
158679
|
158680
|
158681
|
162064