Bug 25429 - Cleanup Database - remove resolved claims returned from db after X days
Summary: Cleanup Database - remove resolved claims returned from db after X days
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Kyle M Hall
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-08 16:57 UTC by Joy Nelson
Modified: 2021-01-12 13:08 UTC (History)
4 users (show)

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


Attachments
Bug 25429: Cleanup Database - remove resolved claims returned from db after X days (2.86 KB, patch)
2020-05-08 18:09 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 25429: Fix typos, correct spacing, add missing periods for script help (6.67 KB, patch)
2020-05-08 18:09 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 25429: Implement system preference, remove command line switch (4.56 KB, patch)
2020-05-12 18:59 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 25429: Cleanup Database - remove resolved claims returned from db after X days (2.83 KB, patch)
2020-12-22 12:30 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 25429: Implement system preference, remove command line switch (4.06 KB, patch)
2020-12-22 12:30 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 25429: Cleanup Database - remove resolved claims returned from db after X days (5.30 KB, patch)
2021-01-11 16:09 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 25429: Script should be able to run with only return claims (783 bytes, patch)
2021-01-12 12:55 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 25429: Cleanup Database - remove resolved claims returned from db after X days (5.30 KB, patch)
2021-01-12 12:56 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 25429: Script should be able to run with only return claims (783 bytes, patch)
2021-01-12 12:57 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 25429: Cleanup Database - remove resolved claims returned from db after X days (5.38 KB, patch)
2021-01-12 13:08 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 25429: Script should be able to run with only return claims (833 bytes, patch)
2021-01-12 13:08 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Joy Nelson 2020-05-08 16:57:25 UTC
Add option to cleanup_database script to removed 'resolved' return claims from the database after a specified number of days.
Comment 1 Andrew Fuerste-Henry 2020-05-08 16:59:32 UTC
Maybe put the number of days in a syspref, make the cron check the syspref when run?
Comment 2 Katrin Fischer 2020-05-08 17:23:01 UTC
(In reply to Andrew Fuerste-Henry from comment #1)
> Maybe put the number of days in a syspref, make the cron check the syspref
> when run?

+1
Comment 3 Kyle M Hall 2020-05-08 18:09:20 UTC
Created attachment 104611 [details] [review]
Bug 25429: Cleanup Database - remove resolved claims returned from db after X days

Add option to cleanup_database script to removed 'resolved' return claims from the database after a specified number of days.

Test Plan:
1) Apply this patch
2) Test cleanup_database with the new --return-claims DAYS option
Comment 4 Kyle M Hall 2020-05-08 18:09:29 UTC
Created attachment 104612 [details] [review]
Bug 25429: Fix typos, correct spacing, add missing periods for script help
Comment 5 Katrin Fischer 2020-05-09 17:49:49 UTC
Hi Kyle, did you see comments #1 and #2? I think it would be really great if we could have this as a system preference - it would make things much easier with multiple instances on a server.
Comment 6 Kyle M Hall 2020-05-12 18:59:46 UTC
Created attachment 104798 [details] [review]
Bug 25429: Implement system preference, remove command line switch
Comment 7 Andrew Fuerste-Henry 2020-12-21 21:03:16 UTC
Kyle, can you please rebase this? Thanks!
Comment 8 Kyle M Hall 2020-12-22 12:30:41 UTC
Created attachment 114601 [details] [review]
Bug 25429: Cleanup Database - remove resolved claims returned from db after X days

Add option to cleanup_database script to removed 'resolved' return claims from the database after a specified number of days.

Test Plan:
1) Apply this patch
2) Test cleanup_database with the new --return-claims DAYS option
Comment 9 Kyle M Hall 2020-12-22 12:30:51 UTC
Created attachment 114602 [details] [review]
Bug 25429: Implement system preference, remove command line switch
Comment 10 Andrew Fuerste-Henry 2020-12-23 15:52:38 UTC
After applying this patch, I get the error "unknown option: return-claims" when I run "perl misc/cronjobs/cleanup_database.pl --return-claims 40 --confirm"
Comment 11 Kyle M Hall 2021-01-11 16:09:03 UTC
Created attachment 115042 [details] [review]
Bug 25429: Cleanup Database - remove resolved claims returned from db after X days

Add option to cleanup_database script to removed 'resolved' return claims from the database after a specified number of days.

Test Plan:
1) Apply this patch
2) Set the new syspref CleanUpDatabaseReturnClaims to a number of days
3) Run cleanup_database.pl
4) Note resolved claims older than the specified number of days are removed from the database

Bug 25429: Implement system preference, remove command line switch
Comment 12 Andrew Fuerste-Henry 2021-01-11 20:04:19 UTC
Can we make the cron require a --claims flag or something comparable? It seems likely to create confusion down the line to have this cron perform an action based on a syspref value without some obvious indicator in the cron line itself. 

Additionally, as it is now I am unable to remove resolved claims without *also* doing something else with the cron. If I run this with just "--confirm," the cron just spits out the help text and wants me to try again with something actually set. Not that anyone's likely to be running this with no other flags, but it's a confusion easily avoided.
Comment 13 Kyle M Hall 2021-01-12 12:53:38 UTC
(In reply to Andrew Fuerste-Henry from comment #12)
> Can we make the cron require a --claims flag or something comparable? It
> seems likely to create confusion down the line to have this cron perform an
> action based on a syspref value without some obvious indicator in the cron
> line itself. 
> 
> Additionally, as it is now I am unable to remove resolved claims without
> *also* doing something else with the cron. If I run this with just
> "--confirm," the cron just spits out the help text and wants me to try again
> with something actually set. Not that anyone's likely to be running this
> with no other flags, but it's a confusion easily avoided.

I don't understand the purpose of moving the value to a syspref if it still requires a cli flag to run.
Comment 14 Kyle M Hall 2021-01-12 12:55:42 UTC
Created attachment 115086 [details] [review]
Bug 25429: Script should be able to run with only return claims
Comment 15 Kyle M Hall 2021-01-12 12:56:51 UTC
Created attachment 115087 [details] [review]
Bug 25429: Cleanup Database - remove resolved claims returned from db after X days

Add option to cleanup_database script to removed 'resolved' return claims from the database after a specified number of days.

Test Plan:
1) Apply this patch
2) Set the new syspref CleanUpDatabaseReturnClaims to a number of days
3) Run cleanup_database.pl
4) Note resolved claims older than the specified number of days are removed from the database

Bug 25429: Implement system preference, remove command line switch
Comment 16 Kyle M Hall 2021-01-12 12:57:01 UTC
Created attachment 115088 [details] [review]
Bug 25429: Script should be able to run with only return claims
Comment 17 Andrew Fuerste-Henry 2021-01-12 13:08:39 UTC
Created attachment 115089 [details] [review]
Bug 25429: Cleanup Database - remove resolved claims returned from db after X days

Add option to cleanup_database script to removed 'resolved' return claims from the database after a specified number of days.

Test Plan:
1) Apply this patch
2) Set the new syspref CleanUpDatabaseReturnClaims to a number of days
3) Run cleanup_database.pl
4) Note resolved claims older than the specified number of days are removed from the database

Bug 25429: Implement system preference, remove command line switch

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Comment 18 Andrew Fuerste-Henry 2021-01-12 13:08:42 UTC
Created attachment 115090 [details] [review]
Bug 25429: Script should be able to run with only return claims

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>