Lines 91-96
Usage: $0 [-h|--help] [--sessions] [--sessdays DAYS] [-v|--verbose] [--zebraqueu
Link Here
|
91 |
--old-reserves DAYS Purge reserves (old_reserves) more than DAYS old. |
91 |
--old-reserves DAYS Purge reserves (old_reserves) more than DAYS old. |
92 |
--transfers DAYS Purge transfers completed more than DAYS day ago. |
92 |
--transfers DAYS Purge transfers completed more than DAYS day ago. |
93 |
--labels DAYS Purge label items added more than DAYS days ago. |
93 |
--labels DAYS Purge label items added more than DAYS days ago. |
|
|
94 |
--cards DAY Purge card creator patrons added more than DAYS days ago. |
94 |
|
95 |
|
95 |
USAGE |
96 |
USAGE |
96 |
exit $_[0]; |
97 |
exit $_[0]; |
Lines 125-130
my $pOldIssues;
Link Here
|
125 |
my $pOldReserves; |
126 |
my $pOldReserves; |
126 |
my $pTransfers; |
127 |
my $pTransfers; |
127 |
my $labels; |
128 |
my $labels; |
|
|
129 |
my $cards; |
128 |
|
130 |
|
129 |
GetOptions( |
131 |
GetOptions( |
130 |
'h|help' => \$help, |
132 |
'h|help' => \$help, |
Lines 155-161
GetOptions(
Link Here
|
155 |
'old-issues:i' => \$pOldIssues, |
157 |
'old-issues:i' => \$pOldIssues, |
156 |
'old-reserves:i' => \$pOldReserves, |
158 |
'old-reserves:i' => \$pOldReserves, |
157 |
'transfers:i' => \$pTransfers, |
159 |
'transfers:i' => \$pTransfers, |
158 |
'labels:i' => \$labels, |
160 |
'labels:i' => \$labels, |
|
|
161 |
'cards:i' => \$cards, |
159 |
) || usage(1); |
162 |
) || usage(1); |
160 |
|
163 |
|
161 |
# Use default values |
164 |
# Use default values |
Lines 197-202
unless ( $sessions
Link Here
|
197 |
|| $pOldReserves |
200 |
|| $pOldReserves |
198 |
|| $pTransfers |
201 |
|| $pTransfers |
199 |
|| $labels |
202 |
|| $labels |
|
|
203 |
|| $cards |
200 |
) { |
204 |
) { |
201 |
print "You did not specify any cleanup work for the script to do.\n\n"; |
205 |
print "You did not specify any cleanup work for the script to do.\n\n"; |
202 |
usage(1); |
206 |
usage(1); |
Lines 497-502
if ($labels) {
Link Here
|
497 |
print "Done with purging label items older than $labels days from batches.\n" if $verbose; |
501 |
print "Done with purging label items older than $labels days from batches.\n" if $verbose; |
498 |
} |
502 |
} |
499 |
|
503 |
|
|
|
504 |
if ($cards) { |
505 |
print "Purging card creator patrons older than $cards days from batches.\n" if $verbose; |
506 |
$sth = $dbh->prepare( |
507 |
q{ |
508 |
DELETE FROM creator_batches |
509 |
WHERE timestamp < date_sub(curdate(), interval ? day) AND creator='Patroncards' |
510 |
} |
511 |
); |
512 |
$sth->execute($cards) or die $dbh->errstr; |
513 |
print "Done with purging card creator patrons older than $cards days from batches.\n" if $verbose; |
514 |
} |
515 |
|
500 |
exit(0); |
516 |
exit(0); |
501 |
|
517 |
|
502 |
sub RemoveOldSessions { |
518 |
sub RemoveOldSessions { |
503 |
- |
|
|