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 162-167
GetOptions(
Link Here
|
162 |
'restrictions:i' => \$pDebarments, |
166 |
'restrictions:i' => \$pDebarments, |
163 |
'all-restrictions' => \$allDebarments, |
167 |
'all-restrictions' => \$allDebarments, |
164 |
'del-exp-selfreg' => \$pExpSelfReg, |
168 |
'del-exp-selfreg' => \$pExpSelfReg, |
|
|
169 |
'del-exp-selfreg-type' => \$pExpSelfRegType, |
165 |
'del-unv-selfreg' => \$pUnvSelfReg, |
170 |
'del-unv-selfreg' => \$pUnvSelfReg, |
166 |
'unique-holidays:i' => \$special_holidays_days, |
171 |
'unique-holidays:i' => \$special_holidays_days, |
167 |
'temp-uploads' => \$temp_uploads, |
172 |
'temp-uploads' => \$temp_uploads, |
Lines 222-227
unless ( $sessions
Link Here
|
222 |
|| $pPseudoTransactionsFrom |
227 |
|| $pPseudoTransactionsFrom |
223 |
|| $pPseudoTransactionsTo |
228 |
|| $pPseudoTransactionsTo |
224 |
|| $pMessages |
229 |
|| $pMessages |
|
|
230 |
|| ( !defined $pExpSelfRegType || $pExpSelfRegType !~ m/^hard|soft$/ ) |
225 |
) { |
231 |
) { |
226 |
print "You did not specify any cleanup work for the script to do.\n\n"; |
232 |
print "You did not specify any cleanup work for the script to do.\n\n"; |
227 |
usage(1); |
233 |
usage(1); |
Lines 429-435
if ($verbose) {
Link Here
|
429 |
# But non trivial changes to C4::Members need to be done before. |
435 |
# But non trivial changes to C4::Members need to be done before. |
430 |
if( $pExpSelfReg ) { |
436 |
if( $pExpSelfReg ) { |
431 |
if ( $confirm ) { |
437 |
if ( $confirm ) { |
432 |
DeleteExpiredSelfRegs(); |
438 |
DeleteExpiredSelfRegs( $pExpSelfRegType ); |
433 |
} elsif ( $verbose ) { |
439 |
} elsif ( $verbose ) { |
434 |
say "self-registered borrowers may be deleted"; |
440 |
say "self-registered borrowers may be deleted"; |
435 |
} |
441 |
} |
Lines 689-695
sub PurgeDebarments {
Link Here
|
689 |
} |
695 |
} |
690 |
|
696 |
|
691 |
sub DeleteExpiredSelfRegs { |
697 |
sub DeleteExpiredSelfRegs { |
692 |
my $cnt= C4::Members::DeleteExpiredOpacRegistrations(); |
698 |
my ( $type ) = @_; |
|
|
699 |
my $cnt = C4::Members::DeleteExpiredOpacRegistrations( $type ); |
693 |
print "Removed $cnt expired self-registered borrowers\n" if $verbose; |
700 |
print "Removed $cnt expired self-registered borrowers\n" if $verbose; |
694 |
} |
701 |
} |
695 |
|
702 |
|
696 |
- |
|
|