Lines 53-108
use Koha::PseudonymizedTransactions;
Link Here
|
53 |
|
53 |
|
54 |
sub usage { |
54 |
sub usage { |
55 |
print STDERR <<USAGE; |
55 |
print STDERR <<USAGE; |
56 |
Usage: $0 [-h|--help] [--confirm] [--sessions] [--sessdays DAYS] [-v|--verbose] [--zebraqueue DAYS] [-m|--mail] [--merged] [--import DAYS] [--logs DAYS] [--searchhistory DAYS] [--restrictions DAYS] [--all-restrictions] [--fees DAYS] [--temp-uploads] [--temp-uploads-days DAYS] [--uploads-missing 0|1 ] [--statistics DAYS] [--deleted-catalog DAYS] [--deleted-patrons DAYS] [--old-issues DAYS] [--old-reserves DAYS] [--transfers DAYS] |
56 |
Usage: $0 [-h|--help] [--confirm] [--sessions] [--sessdays DAYS] [-v|--verbose] [--zebraqueue DAYS] [-m|--mail] [--merged] [--import DAYS] [--logs DAYS] [--searchhistory DAYS] [--restrictions DAYS] [--all-restrictions] [--fees DAYS] [--statute-barred DAYS] [--temp-uploads] [--temp-uploads-days DAYS] [--uploads-missing 0|1 ] [--statistics DAYS] [--deleted-catalog DAYS] [--deleted-patrons DAYS] [--old-issues DAYS] [--old-reserves DAYS] [--transfers DAYS] |
57 |
|
57 |
|
58 |
-h --help prints this help message, and exits, ignoring all |
58 |
-h --help Prints this help message, and exits, ignoring all other options |
59 |
other options |
59 |
--confirm Confirmation flag, the script will be running in dry-run mode is not set. |
60 |
--confirm Confirmation flag, the script will be running in dry-run mode is not set. |
60 |
--sessions Purge the sessions table. If you use this while users |
61 |
--sessions purge the sessions table. If you use this while users |
61 |
are logged into Koha, they will have to reconnect. |
62 |
are logged into Koha, they will have to reconnect. |
62 |
--sessdays DAYS Purge only sessions older than DAYS days. |
63 |
--sessdays DAYS purge only sessions older than DAYS days. |
63 |
-v --verbose Will cause the script to give you a bit more information |
64 |
-v --verbose will cause the script to give you a bit more information |
64 |
about the run. |
65 |
about the run. |
65 |
--zebraqueue DAYS Purge completed zebraqueue entries older than DAYS days. |
66 |
--zebraqueue DAYS purge completed zebraqueue entries older than DAYS days. |
66 |
Defaults to 30 days if no days specified. |
67 |
Defaults to 30 days if no days specified. |
67 |
-m --mail DAYS Purge items from the mail queue that are older than DAYS days. |
68 |
-m --mail DAYS purge items from the mail queue that are older than DAYS days. |
68 |
Defaults to 30 days if no days specified. |
69 |
Defaults to 30 days if no days specified. |
69 |
--merged Purge completed entries from need_merge_authorities. |
70 |
--merged purged completed entries from need_merge_authorities. |
70 |
--import DAYS Purge records from import tables older than DAYS days. |
71 |
--import DAYS purge records from import tables older than DAYS days. |
71 |
Defaults to 60 days if no days specified. |
72 |
Defaults to 60 days if no days specified. |
72 |
--z3950 Purge records from import tables that are the result |
73 |
--z3950 purge records from import tables that are the result |
73 |
of Z39.50 searches |
74 |
of Z39.50 searches |
74 |
--fees DAYS Purge entries accountlines older than DAYS days, where |
75 |
--fees DAYS purge entries accountlines older than DAYS days, where |
75 |
amountoutstanding is 0 or NULL. |
76 |
amountoutstanding is 0 or NULL. |
76 |
In the case of --fees, DAYS must be greater than |
77 |
In the case of --fees, DAYS must be greater than |
77 |
or equal to 1. |
78 |
or equal to 1. |
78 |
--statute-barred DAYS Purge entries accountlines older than DAYS days, where |
79 |
--logs DAYS purge entries from action_logs older than DAYS days. |
79 |
status is RETURNED and amountoutstanding is greater than 0. |
80 |
Defaults to 180 days if no days specified. |
80 |
In the case of --statute-barred, DAYS must be greater than |
81 |
--searchhistory DAYS purge entries from search_history older than DAYS days. |
81 |
or equal to 1. |
82 |
Defaults to 30 days if no days specified |
82 |
--logs DAYS Purge entries from action_logs older than DAYS days. |
83 |
--list-invites DAYS purge (unaccepted) list share invites older than DAYS |
83 |
Defaults to 180 days if no days specified. |
84 |
days. Defaults to 14 days if no days specified. |
84 |
--searchhistory DAYS Purge entries from search_history older than DAYS days. |
85 |
--restrictions DAYS purge patrons restrictions expired since more than DAYS days. |
85 |
Defaults to 30 days if no days specified |
86 |
Defaults to 30 days if no days specified. |
86 |
--list-invites DAYS Purge (unaccepted) list share invites older than DAYS |
87 |
--all-restrictions purge all expired patrons restrictions. |
87 |
days. Defaults to 14 days if no days specified. |
88 |
--del-exp-selfreg Delete expired self registration accounts |
88 |
--restrictions DAYS Purge patrons restrictions expired since more than DAYS days. |
89 |
--del-unv-selfreg DAYS Delete unverified self registrations older than DAYS |
89 |
Defaults to 30 days if no days specified. |
90 |
--unique-holidays DAYS Delete all unique holidays older than DAYS |
90 |
--all-restrictions Purge all expired patrons restrictions. |
91 |
--temp-uploads Delete temporary uploads. |
91 |
--del-exp-selfreg Delete expired self registration accounts |
92 |
--temp-uploads-days DAYS Override the corresponding preference value. |
92 |
--del-unv-selfreg DAYS Delete unverified self registrations older than DAYS |
93 |
--uploads-missing FLAG Delete upload records for missing files when FLAG is true, count them otherwise |
93 |
--unique-holidays DAYS Delete all unique holidays older than DAYS |
94 |
--oauth-tokens Delete expired OAuth2 tokens |
94 |
--temp-uploads Delete temporary uploads. |
95 |
--statistics DAYS Purge statistics entries more than DAYS days old. |
95 |
--temp-uploads-days DAYS Override the corresponding preference value. |
96 |
This table is used to build reports, make sure you are aware of the consequences of this before using it! |
96 |
--uploads-missing FLAG Delete upload records for missing files when FLAG is true, |
97 |
--deleted-catalog DAYS Purge catalog records deleted more then DAYS days ago |
97 |
count them otherwise |
98 |
(from tables deleteditems, deletedbiblioitems, deletedbiblio_metadata and deletedbiblio). |
98 |
--oauth-tokens Delete expired OAuth2 tokens |
99 |
--deleted-patrons DAYS Purge patrons deleted more than DAYS days ago. |
99 |
--statistics DAYS Purge statistics entries more than DAYS days old. |
100 |
--old-issues DAYS Purge checkouts (old_issues) returned more than DAYS days ago. |
100 |
This table is used to build reports, make sure you are |
101 |
--old-reserves DAYS Purge reserves (old_reserves) more than DAYS old. |
101 |
aware of the consequences of this before using it! |
102 |
--transfers DAYS Purge transfers completed more than DAYS day ago. |
102 |
--deleted-catalog DAYS Purge catalog records deleted more then DAYS days ago |
103 |
--pseudo-transactions DAYS Purge the pseudonymized transactions that have been originally created more than DAYS days ago |
103 |
(from tables deleteditems, deletedbiblioitems, |
|
|
104 |
deletedbiblio_metadata and deletedbiblio). |
105 |
--deleted-patrons DAYS Purge patrons deleted more than DAYS days ago. |
106 |
--old-issues DAYS Purge checkouts (old_issues) returned more than DAYS days ago. |
107 |
--old-reserves DAYS Purge reserves (old_reserves) more than DAYS old. |
108 |
--transfers DAYS Purge transfers completed more than DAYS day ago. |
109 |
--pseudo-transactions DAYS Purge the pseudonymized transactions that have been |
110 |
originally created more than DAYS days ago |
104 |
DAYS is optional and can be replaced by: |
111 |
DAYS is optional and can be replaced by: |
105 |
--pseudo-transactions-from YYYY-MM-DD and/or --pseudo-transactions-to YYYY-MM-DD |
112 |
--pseudo-transactions-from YYYY-MM-DD |
|
|
113 |
and/or --pseudo-transactions-to YYYY-MM-DD |
106 |
USAGE |
114 |
USAGE |
107 |
exit $_[0]; |
115 |
exit $_[0]; |
108 |
} |
116 |
} |
Lines 125-130
my $allDebarments;
Link Here
|
125 |
my $pExpSelfReg; |
133 |
my $pExpSelfReg; |
126 |
my $pUnvSelfReg; |
134 |
my $pUnvSelfReg; |
127 |
my $fees_days; |
135 |
my $fees_days; |
|
|
136 |
my $statute_barred_days; |
128 |
my $special_holidays_days; |
137 |
my $special_holidays_days; |
129 |
my $temp_uploads; |
138 |
my $temp_uploads; |
130 |
my $temp_uploads_days; |
139 |
my $temp_uploads_days; |
Lines 139-176
my $pTransfers;
Link Here
|
139 |
my ( $pPseudoTransactions, $pPseudoTransactionsFrom, $pPseudoTransactionsTo ); |
148 |
my ( $pPseudoTransactions, $pPseudoTransactionsFrom, $pPseudoTransactionsTo ); |
140 |
|
149 |
|
141 |
GetOptions( |
150 |
GetOptions( |
142 |
'h|help' => \$help, |
151 |
'h|help' => \$help, |
143 |
'confirm' => \$confirm, |
152 |
'confirm' => \$confirm, |
144 |
'sessions' => \$sessions, |
153 |
'sessions' => \$sessions, |
145 |
'sessdays:i' => \$sess_days, |
154 |
'sessdays:i' => \$sess_days, |
146 |
'v|verbose' => \$verbose, |
155 |
'v|verbose' => \$verbose, |
147 |
'm|mail:i' => \$mail, |
156 |
'm|mail:i' => \$mail, |
148 |
'zebraqueue:i' => \$zebraqueue_days, |
157 |
'zebraqueue:i' => \$zebraqueue_days, |
149 |
'merged' => \$purge_merged, |
158 |
'merged' => \$purge_merged, |
150 |
'import:i' => \$pImport, |
159 |
'import:i' => \$pImport, |
151 |
'z3950' => \$pZ3950, |
160 |
'z3950' => \$pZ3950, |
152 |
'logs:i' => \$pLogs, |
161 |
'logs:i' => \$pLogs, |
153 |
'fees:i' => \$fees_days, |
162 |
'fees:i' => \$fees_days, |
154 |
'searchhistory:i' => \$pSearchhistory, |
163 |
'statute-barred:i' => \$statute_barred_days, |
155 |
'list-invites:i' => \$pListShareInvites, |
164 |
'searchhistory:i' => \$pSearchhistory, |
156 |
'restrictions:i' => \$pDebarments, |
165 |
'list-invites:i' => \$pListShareInvites, |
157 |
'all-restrictions' => \$allDebarments, |
166 |
'restrictions:i' => \$pDebarments, |
158 |
'del-exp-selfreg' => \$pExpSelfReg, |
167 |
'all-restrictions' => \$allDebarments, |
159 |
'del-unv-selfreg' => \$pUnvSelfReg, |
168 |
'del-exp-selfreg' => \$pExpSelfReg, |
160 |
'unique-holidays:i' => \$special_holidays_days, |
169 |
'del-unv-selfreg' => \$pUnvSelfReg, |
161 |
'temp-uploads' => \$temp_uploads, |
170 |
'unique-holidays:i' => \$special_holidays_days, |
162 |
'temp-uploads-days:i' => \$temp_uploads_days, |
171 |
'temp-uploads' => \$temp_uploads, |
163 |
'uploads-missing:i' => \$uploads_missing, |
172 |
'temp-uploads-days:i' => \$temp_uploads_days, |
164 |
'oauth-tokens' => \$oauth_tokens, |
173 |
'uploads-missing:i' => \$uploads_missing, |
165 |
'statistics:i' => \$pStatistics, |
174 |
'oauth-tokens' => \$oauth_tokens, |
166 |
'deleted-catalog:i' => \$pDeletedCatalog, |
175 |
'statistics:i' => \$pStatistics, |
167 |
'deleted-patrons:i' => \$pDeletedPatrons, |
176 |
'deleted-catalog:i' => \$pDeletedCatalog, |
168 |
'old-issues:i' => \$pOldIssues, |
177 |
'deleted-patrons:i' => \$pDeletedPatrons, |
169 |
'old-reserves:i' => \$pOldReserves, |
178 |
'old-issues:i' => \$pOldIssues, |
170 |
'transfers:i' => \$pTransfers, |
179 |
'old-reserves:i' => \$pOldReserves, |
171 |
'pseudo-transactions:i' => \$pPseudoTransactions, |
180 |
'transfers:i' => \$pTransfers, |
172 |
'pseudo-transactions-from:s' => \$pPseudoTransactionsFrom, |
181 |
'pseudo-transactions:i' => \$pPseudoTransactions, |
173 |
'pseudo-transactions-to:s' => \$pPseudoTransactionsTo, |
182 |
'pseudo-transactions-from:s' => \$pPseudoTransactionsFrom, |
|
|
183 |
'pseudo-transactions-to:s' => \$pPseudoTransactionsTo, |
174 |
) || usage(1); |
184 |
) || usage(1); |
175 |
|
185 |
|
176 |
# Use default values |
186 |
# Use default values |
Lines 194-199
unless ( $sessions
Link Here
|
194 |
|| $pImport |
204 |
|| $pImport |
195 |
|| $pLogs |
205 |
|| $pLogs |
196 |
|| $fees_days |
206 |
|| $fees_days |
|
|
207 |
|| $statute_barred_days |
197 |
|| $pSearchhistory |
208 |
|| $pSearchhistory |
198 |
|| $pZ3950 |
209 |
|| $pZ3950 |
199 |
|| $pListShareInvites |
210 |
|| $pListShareInvites |
Lines 340-345
if ($fees_days) {
Link Here
|
340 |
print "Done purging records from accountlines.\n" if $verbose; |
351 |
print "Done purging records from accountlines.\n" if $verbose; |
341 |
} |
352 |
} |
342 |
|
353 |
|
|
|
354 |
if ($statute_barred_days) { |
355 |
print "Purging statute-barred fees from accountlines.\n" if $verbose; |
356 |
purge_statute_barred_fees( $statute_barred_days ); |
357 |
print "Done purging statute-barred fees from accountlines.\n" if $verbose; |
358 |
} |
359 |
|
343 |
if ($pSearchhistory) { |
360 |
if ($pSearchhistory) { |
344 |
print "Purging records older than $pSearchhistory from search_history.\n" if $verbose; |
361 |
print "Purging records older than $pSearchhistory from search_history.\n" if $verbose; |
345 |
C4::Search::History::delete({ interval => $pSearchhistory }) if $confirm; |
362 |
C4::Search::History::delete({ interval => $pSearchhistory }) if $confirm; |
346 |
- |
|
|