Bugzilla – Attachment 147671 Details for
Bug 32686
Specify action of action_logs entries to purge
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32686: Specify action of action_logs to purge
Bug-32686-Specify-action-of-actionlogs-to-purge.patch (text/plain), 2.75 KB, created by
Alex Buckley
on 2023-03-02 20:49:42 UTC
(
hide
)
Description:
Bug 32686: Specify action of action_logs to purge
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2023-03-02 20:49:42 UTC
Size:
2.75 KB
patch
obsolete
>From 5a6494f2bbc76711c31922035b47ce0b1cd35087 Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Thu, 19 Jan 2023 01:29:37 +0000 >Subject: [PATCH] Bug 32686: Specify action of action_logs to purge > >Add --log-action parameter to cleanup_database.pl > >Test plan: >1. Apply patch >2. Enable cataloguing and borrowers log >3. Make some changes to borrowers, create some borrowers, and edit some >biblio records >4. Change the action_logs.timestamp for all action_logs entries to 367 >days ago >5. Run cleanup_database.pl with --logs 365 --log-module=MEMBERS >--log-action=CREATE --confirm >6. Confirm only the borrowers creation action_logs entries are removed >7. Run cleanup_database.pl with --logs 365 >8. Confirm all action_logs entries are removed > >Sponsored-By: Toi Ohomai Institute of Technology, New Zealand >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> >--- > misc/cronjobs/cleanup_database.pl | 7 +++++++ > 1 file changed, 7 insertions(+) > >diff --git a/misc/cronjobs/cleanup_database.pl b/misc/cronjobs/cleanup_database.pl >index c33dede4e53..60b36520121 100755 >--- a/misc/cronjobs/cleanup_database.pl >+++ b/misc/cronjobs/cleanup_database.pl >@@ -84,6 +84,7 @@ Usage: $0 [-h|--help] [--confirm] [--sessions] [--sessdays DAYS] [-v|--verbose] > or equal to 1. > --log-modules Specify which action log modules to trim. Repeatable. > --preserve-log Specify which action logs to exclude. Repeatable. >+ --log-action Specify which action log action entries to trim. Repeatable. > --logs DAYS purge entries from action_logs older than DAYS days. > Defaults to 180 days if no days specified. > --searchhistory DAYS purge entries from search_history older than DAYS days. >@@ -162,6 +163,7 @@ my $labels; > my $cards; > my @log_modules; > my @preserve_logs; >+my @log_actions; > my $jobs_days; > my @jobs_types; > my $reports; >@@ -183,6 +185,7 @@ GetOptions( > 'logs:i' => \$pLogs, > 'log-module:s' => \@log_modules, > 'preserve-log:s' => \@preserve_logs, >+ 'log-action:s' => \@log_actions, > 'messages:i' => \$pMessages, > 'fees:i' => \$fees_days, > 'searchhistory:i' => \$pSearchhistory, >@@ -386,6 +389,10 @@ if ($pLogs) { > $log_query .= " AND module IN (" . join(',',('?') x @log_modules ) . ")"; > push @query_params, @log_modules; > } >+ if( @log_actions ){ >+ $log_query .= " AND action IN (" . join(',',('?') x @log_actions ) . ")"; >+ push @query_params, @log_actions; >+ } > $sth = $dbh->prepare( $log_query ); > if ( $confirm ) { > $sth->execute($pLogs, @query_params) or die $dbh->errstr; >-- >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 32686
:
145499
|
145781
|
147583
| 147671