Bugzilla – Attachment 145781 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.62 KB, created by
David Nind
on 2023-01-27 23:11:02 UTC
(
hide
)
Description:
Bug 32686: Specify action of action_logs to purge
Filename:
MIME Type:
Creator:
David Nind
Created:
2023-01-27 23:11:02 UTC
Size:
2.62 KB
patch
obsolete
>From c5f12bcfa5372f6e4f0269c3bc827938e4c8cc14 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> >--- > 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 0c32bc02ca..7744a7b3c7 100755 >--- a/misc/cronjobs/cleanup_database.pl >+++ b/misc/cronjobs/cleanup_database.pl >@@ -79,6 +79,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. >@@ -154,6 +155,7 @@ my $labels; > my $cards; > my @log_modules; > my @preserve_logs; >+my @log_actions; > my $jobs_days; > my @jobs_types; > >@@ -173,6 +175,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, >@@ -371,6 +374,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.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 32686
:
145499
|
145781
|
147583
|
147671