Bug 26831: Use new PurgeListShareInvitesOlderThan syspref
Enable librarians in the staff client to control when unaccepted list
invites will be removed from the database.
Test plan:
1. Apply patches
2. Update database
sudo koha-shell <instance>
cd installer/data/mysql
./updatedatabase.pl
3. Confirm the PurgeListShareInvitesOlderThan syspref = 14
4. Run cleanup_database.pl with --list-invites parameter defined:
sudo koha-shell <instance>
cd misc/cronjobs
./cleanup_database.pl --list-invites 10 -v
5. Confirm the output contains:
"Purging unaccepted list share invites older than 10 days."
6. Set PurgeListShareInvitesOlderThan syspref = 15
7. Run cleanup_database.pl without the --list-invites parameter:
sudo koha-shell <instance>
cd misc/cronjobs
./cleanup_database.pl -v
8. Confirm the output contains:
"Purging unaccepted list share invites older than 15 days."
9. Empty PurgeListShareInvitesOlderThan syspref
10. Run cleanup_database without the --list-invites parameter:
sudo koha-shell <instance.
cd misc/cronjobs
./cleanup_database.pl
11. Observe you get the following output (along with documentation on all
parameters of the script):
"You did not specify any cleanup work for the script to do."
12. Run the cleanup_database with no days defined for the --list-invites
parameter:
sudo koha-shell <instance>
cd misc/cronjobs
./cleanup_database.pl --list-invites -v
13. Confirm the output contains:
"Purging unaccepted list share invites older than 14 days."
Sponsored-by: Catalyst IT, New Zealand
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 428f6d5b17)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
3dbe015201
commit
efeb650d7f
|
|
@ -89,8 +89,11 @@ Usage: $0 [-h|--help] [--confirm] [--sessions] [--sessdays DAYS] [-v|--verbose]
|
|||
Defaults to 180 days if no days specified.
|
||||
--searchhistory DAYS purge entries from search_history older than DAYS days.
|
||||
Defaults to 30 days if no days specified
|
||||
--list-invites DAYS purge (unaccepted) list share invites older than DAYS
|
||||
days. Defaults to 14 days if no days specified.
|
||||
--list-invites DAYS purge (unaccepted) list share invites older than DAYS days.
|
||||
This parameter is prioritised over the
|
||||
PurgeListShareInvitesOlderThan system preference.
|
||||
Defaults to 14 days if no days specified for this parameter and
|
||||
the PurgeListShareInvitesOlderThan system preference is empty.
|
||||
--restrictions DAYS purge patrons restrictions expired since more than DAYS days.
|
||||
Defaults to 30 days if no days specified.
|
||||
--all-restrictions purge all expired patrons restrictions.
|
||||
|
|
@ -224,13 +227,24 @@ $pLogs = DEFAULT_LOGS_PURGEDAYS if defined($pLogs)
|
|||
$zebraqueue_days = DEFAULT_ZEBRAQ_PURGEDAYS if defined($zebraqueue_days) && $zebraqueue_days == 0;
|
||||
$mail = DEFAULT_MAIL_PURGEDAYS if defined($mail) && $mail == 0;
|
||||
$pSearchhistory = DEFAULT_SEARCHHISTORY_PURGEDAYS if defined($pSearchhistory) && $pSearchhistory == 0;
|
||||
$pListShareInvites = DEFAULT_SHARE_INVITATION_EXPIRY_DAYS if defined($pListShareInvites) && $pListShareInvites == 0;
|
||||
$pDebarments = DEFAULT_DEBARMENTS_PURGEDAYS if defined($pDebarments) && $pDebarments == 0;
|
||||
$pMessages = DEFAULT_MESSAGES_PURGEDAYS if defined($pMessages) && $pMessages == 0;
|
||||
$jobs_days = DEFAULT_JOBS_PURGEDAYS if defined($jobs_days) && $jobs_days == 0;
|
||||
@jobs_types = (DEFAULT_JOBS_PURGETYPES) if $jobs_days && @jobs_types == 0;
|
||||
$edifact_msg_days = DEFAULT_EDIFACT_MSG_PURGEDAYS if defined($edifact_msg_days) && $edifact_msg_days == 0;
|
||||
|
||||
# Choose the number of days at which to purge unaccepted list invites:
|
||||
# - DAYS defined in the list-invites parameter is prioritised first
|
||||
# - PurgeListShareInvitesOlderThan system preference is prioritised second
|
||||
# - Default value of 14 days is prioritised last - if the list-invites parameter is passed without a DAYS value and the PurgeListShareInvitesOlderThan syspref is empty.
|
||||
if ( !defined($pListShareInvites) ) {
|
||||
if ( C4::Context->preference('PurgeListShareInvitesOlderThan') ) {
|
||||
$pListShareInvites = C4::Context->preference('PurgeListShareInvitesOlderThan');
|
||||
}
|
||||
} elsif ( defined($pListShareInvites) && $pListShareInvites == 0 ) {
|
||||
$pListShareInvites = DEFAULT_SHARE_INVITATION_EXPIRY_DAYS;
|
||||
}
|
||||
|
||||
if ($help) {
|
||||
usage(0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue