|
Lines 27-32
use constant DEFAULT_MESSAGES_PURGEDAYS => 365;
Link Here
|
| 27 |
use constant DEFAULT_SEARCHHISTORY_PURGEDAYS => 30; |
27 |
use constant DEFAULT_SEARCHHISTORY_PURGEDAYS => 30; |
| 28 |
use constant DEFAULT_SHARE_INVITATION_EXPIRY_DAYS => 14; |
28 |
use constant DEFAULT_SHARE_INVITATION_EXPIRY_DAYS => 14; |
| 29 |
use constant DEFAULT_DEBARMENTS_PURGEDAYS => 30; |
29 |
use constant DEFAULT_DEBARMENTS_PURGEDAYS => 30; |
|
|
30 |
use constant DEFAULT_EXP_SELFREG_TYPE => 'hard'; |
| 30 |
|
31 |
|
| 31 |
BEGIN { |
32 |
BEGIN { |
| 32 |
# find Koha's Perl modules |
33 |
# find Koha's Perl modules |
|
Lines 89-97
Usage: $0 [-h|--help] [--confirm] [--sessions] [--sessdays DAYS] [-v|--verbose]
Link Here
|
| 89 |
--restrictions DAYS purge patrons restrictions expired since more than DAYS days. |
90 |
--restrictions DAYS purge patrons restrictions expired since more than DAYS days. |
| 90 |
Defaults to 30 days if no days specified. |
91 |
Defaults to 30 days if no days specified. |
| 91 |
--all-restrictions purge all expired patrons restrictions. |
92 |
--all-restrictions purge all expired patrons restrictions. |
| 92 |
--del-exp-selfreg Delete expired self registration accounts |
93 |
--del-exp-selfreg Delete expired self registration accounts |
| 93 |
--del-unv-selfreg DAYS Delete unverified self registrations older than DAYS |
94 |
--del-exp-selfreg-type TYPE Option 'hard' completely removes patrons from the database, |
| 94 |
--unique-holidays DAYS Delete all unique holidays older than DAYS |
95 |
Option 'soft' moves patron to deleted patrons table. |
|
|
96 |
--del-unv-selfreg DAYS Delete unverified self registrations older than DAYS |
| 97 |
--unique-holidays DAYS Delete all unique holidays older than DAYS |
| 95 |
--temp-uploads Delete temporary uploads. |
98 |
--temp-uploads Delete temporary uploads. |
| 96 |
--temp-uploads-days DAYS Override the corresponding preference value. |
99 |
--temp-uploads-days DAYS Override the corresponding preference value. |
| 97 |
--uploads-missing FLAG Delete upload records for missing files when FLAG is true, count them otherwise |
100 |
--uploads-missing FLAG Delete upload records for missing files when FLAG is true, count them otherwise |
|
Lines 127-132
my $pListShareInvites;
Link Here
|
| 127 |
my $pDebarments; |
130 |
my $pDebarments; |
| 128 |
my $allDebarments; |
131 |
my $allDebarments; |
| 129 |
my $pExpSelfReg; |
132 |
my $pExpSelfReg; |
|
|
133 |
my $pExpSelfRegType = 'hard'; |
| 130 |
my $pUnvSelfReg; |
134 |
my $pUnvSelfReg; |
| 131 |
my $fees_days; |
135 |
my $fees_days; |
| 132 |
my $special_holidays_days; |
136 |
my $special_holidays_days; |
|
Lines 163-168
GetOptions(
Link Here
|
| 163 |
'restrictions:i' => \$pDebarments, |
167 |
'restrictions:i' => \$pDebarments, |
| 164 |
'all-restrictions' => \$allDebarments, |
168 |
'all-restrictions' => \$allDebarments, |
| 165 |
'del-exp-selfreg' => \$pExpSelfReg, |
169 |
'del-exp-selfreg' => \$pExpSelfReg, |
|
|
170 |
'del-exp-selfreg-type:s' => \$pExpSelfRegType, |
| 166 |
'del-unv-selfreg' => \$pUnvSelfReg, |
171 |
'del-unv-selfreg' => \$pUnvSelfReg, |
| 167 |
'unique-holidays:i' => \$special_holidays_days, |
172 |
'unique-holidays:i' => \$special_holidays_days, |
| 168 |
'temp-uploads' => \$temp_uploads, |
173 |
'temp-uploads' => \$temp_uploads, |
|
Lines 224-229
unless ( $sessions
Link Here
|
| 224 |
|| $pPseudoTransactionsTo |
229 |
|| $pPseudoTransactionsTo |
| 225 |
|| $pMessages |
230 |
|| $pMessages |
| 226 |
|| defined $lock_days && $lock_days ne q{} |
231 |
|| defined $lock_days && $lock_days ne q{} |
|
|
232 |
|| $pExpSelfRegType !~ m/^hard|soft$/ |
| 227 |
) { |
233 |
) { |
| 228 |
print "You did not specify any cleanup work for the script to do.\n\n"; |
234 |
print "You did not specify any cleanup work for the script to do.\n\n"; |
| 229 |
usage(1); |
235 |
usage(1); |
|
Lines 443-449
if ($verbose) {
Link Here
|
| 443 |
# But non trivial changes to C4::Members need to be done before. |
449 |
# But non trivial changes to C4::Members need to be done before. |
| 444 |
if( $pExpSelfReg ) { |
450 |
if( $pExpSelfReg ) { |
| 445 |
if ( $confirm ) { |
451 |
if ( $confirm ) { |
| 446 |
DeleteExpiredSelfRegs(); |
452 |
DeleteExpiredSelfRegs( $pExpSelfRegType ); |
| 447 |
} elsif ( $verbose ) { |
453 |
} elsif ( $verbose ) { |
| 448 |
say "self-registered borrowers may be deleted"; |
454 |
say "self-registered borrowers may be deleted"; |
| 449 |
} |
455 |
} |
|
Lines 703-709
sub PurgeDebarments {
Link Here
|
| 703 |
} |
709 |
} |
| 704 |
|
710 |
|
| 705 |
sub DeleteExpiredSelfRegs { |
711 |
sub DeleteExpiredSelfRegs { |
| 706 |
my $cnt= C4::Members::DeleteExpiredOpacRegistrations(); |
712 |
my ( $type ) = @_; |
|
|
713 |
my $cnt = C4::Members::DeleteExpiredOpacRegistrations( $type ); |
| 707 |
print "Removed $cnt expired self-registered borrowers\n" if $verbose; |
714 |
print "Removed $cnt expired self-registered borrowers\n" if $verbose; |
| 708 |
} |
715 |
} |
| 709 |
|
716 |
|
| 710 |
- |
|
|