Bug 7240 - Cleaning up import tables and action_logs
Summary: Cleaning up import tables and action_logs
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: 3.8
Hardware: All All
: P3 enhancement (vote)
Assignee: Marcel de Rooy
QA Contact: Ian Walls
: 6793 (view as bug list)
Depends on:
Reported: 2011-11-17 12:28 UTC by Marcel de Rooy
Modified: 2013-07-16 12:39 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:

Patch (5.48 KB, patch)
2011-11-21 12:44 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Patch (5.48 KB, patch)
2011-11-21 12:51 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 7240: Cleaning up import tables and action_logs (5.55 KB, patch)
2011-12-13 09:13 UTC, Chris Cormack
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel de Rooy 2011-11-17 12:28:43 UTC
I already asked on dev list:
> Is anyone of you using code to periodically purge records from 
> import_records, import_biblios, import_batches and/or action_logs ?
> If so, would it be an idea to include such code into 
> cleanup_database.pl in misc/cronjobs ?

Response of Paul on dev list:
+1 Sounds a very good idea. We have already made a dirty mysql "truncate xxx" on some setups IIRC. Would be better to have it in cleanup_database.

I also agree it should be driven by a parameter, like the number in days to keep/clean. Something like cleanup_database --import 90 --action_logs 180 (90 days for import_* tables and 180 for action logs in this example)

And if no parameter are given, either do nothing or remove after a default duration (30 for import ? 90 for action_logs ?)

Will be sending a proposed patch.
Comment 1 Marcel de Rooy 2011-11-21 12:44:53 UTC Comment hidden (obsolete)
Comment 2 Marcel de Rooy 2011-11-21 12:47:29 UTC
four should be five
Comment 3 Marcel de Rooy 2011-11-21 12:51:33 UTC Comment hidden (obsolete)
Comment 4 Chris Cormack 2011-12-13 09:13:13 UTC
Created attachment 6741 [details] [review]
Bug 7240: Cleaning up import tables and action_logs

This patch lets cleanup_database also purge older records from the (five) import tables and the action_logs table.
Two new command line parameters are introduced: --import and --logs.
If no number of days is specified for --zebraqueue, --import or --logs, it defaults to 30 days, 60 days resp. 180 days.
I did not add a default for --sessdays, because this parameter cannot be seen separately from parameter --sessions.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Adds new parameters and code, does not change existing behaviour
Comment 5 Paul Poulain 2012-01-13 13:04:19 UTC
QA comment: easy to read code -congrat-, usefull feature,  properly documented. The only perlcritic error was here before the patch

passed QA

patch pushed please test
Comment 6 Jonathan Druart 2013-07-16 12:39:38 UTC
*** Bug 6793 has been marked as a duplicate of this bug. ***