Bug 28962: Add del-unv-selfreg to crontab

We also add a test by inserting a simulated borrower modification
record in the same table which should not be deleted.

NOTE: This patch fixes the del-unv-selfreg parameter in the
cleanup db script. It did not even do what it promised :)

Test plan:
Verify if the crontab change is correct.
Run t/db_dependent/Members.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Marcel de Rooy 2021-09-07 14:14:44 +00:00 committed by Fridolin Somers
parent 60ab9ddcfb
commit c200bf6bc9
4 changed files with 6 additions and 3 deletions

View File

@ -23,7 +23,7 @@ koha-foreach --chdir --enabled --email /usr/share/koha/bin/cronjobs/advance_noti
koha-foreach --chdir --enabled /usr/share/koha/bin/cronjobs/serialsUpdate.pl -c
koha-foreach --chdir --enabled /usr/share/koha/bin/cronjobs/membership_expiry.pl -c
koha-foreach --chdir --enabled /usr/share/koha/bin/cronjobs/holds/cancel_expired_holds.pl >/dev/null 2>&1
koha-foreach --chdir --enabled /usr/share/koha/bin/cronjobs/cleanup_database.pl --confirm --sessions --zebraqueue 10 --list-invites --temp-uploads
koha-foreach --chdir --enabled /usr/share/koha/bin/cronjobs/cleanup_database.pl --confirm --sessions --zebraqueue 10 --list-invites --temp-uploads --del-unv-selfreg 14
koha-foreach --chdir --enabled --noemail /usr/share/koha/bin/cronjobs/cleanup_database.pl --confirm --mail
koha-foreach --chdir --enabled /usr/share/koha/bin/cronjobs/holds/auto_unsuspend_holds.pl > /dev/null 2>&1
koha-foreach --chdir --enabled /usr/share/koha/bin/cronjobs/merge_authorities.pl -b

View File

@ -170,7 +170,7 @@ GetOptions(
'restrictions:i' => \$pDebarments,
'all-restrictions' => \$allDebarments,
'del-exp-selfreg' => \$pExpSelfReg,
'del-unv-selfreg' => \$pUnvSelfReg,
'del-unv-selfreg:i' => \$pUnvSelfReg,
'unique-holidays:i' => \$special_holidays_days,
'temp-uploads' => \$temp_uploads,
'temp-uploads-days:i' => \$temp_uploads_days,

View File

@ -84,7 +84,7 @@ KOHA_CRON_PATH = /usr/share/koha/bin/cronjobs
*/10 * * * * __KOHA_USER__ $KOHA_CRON_PATH/../migration_tools/rebuild_zebra.pl -b -a -z >/dev/null
# clean up databases nightly. Be sure not to run this with --sessions during a time when the system is in use!
16 1 * * * __KOHA_USER__ $KOHA_CRON_PATH/cleanup_database.pl --confirm --sessions --zebraqueue 10 --list-invites --temp-uploads
16 1 * * * __KOHA_USER__ $KOHA_CRON_PATH/cleanup_database.pl --confirm --sessions --zebraqueue 10 --list-invites --temp-uploads --del-unv-selfreg 14
# delete old purchase suggestions weekly. Replace XX with a number to define the age of suggestions to delete.
@weekly __KOHA_USER__ $KOHA_CRON_PATH/purge_suggestions.pl --confirm --days XX > /dev/null 2>&1

View File

@ -411,6 +411,9 @@ subtest 'purgeSelfRegistration' => sub {
foreach(1..3) {
$dbh->do("INSERT INTO borrower_modifications (timestamp, borrowernumber, verification_token, changed_fields) VALUES ('2014-01-01 01:02:03',0,?,'firstname,surname')", undef, (scalar localtime)."_$_");
}
# Add a record with a borrowernumber which should not be deleted by DeleteUnverifiedOpacRegistrations
# NOTE: We are using the borrowernumber from the last test outside this subtest
$dbh->do( "INSERT INTO borrower_modifications (timestamp, borrowernumber, verification_token, changed_fields) VALUES ('2014-01-01 01:02:03', ?, '', 'firstname,surname' )", undef, $borrowernumber );
is( C4::Members::DeleteUnverifiedOpacRegistrations($d), 3, 'Test for DeleteUnverifiedOpacRegistrations' );
#purge members in temporary category