Lines 90-97
Usage: $0 [-h|--help] [--sessions] [--sessdays DAYS] [-v|--verbose] [--zebraqueu
Link Here
|
90 |
--old-issues DAYS Purge checkouts (old_issues) returned more than DAYS days ago. |
90 |
--old-issues DAYS Purge checkouts (old_issues) returned more than DAYS days ago. |
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 item label batches last added to more than DAYS days ago. |
94 |
--cards DAY Purge card creator patrons added more than DAYS days ago. |
94 |
--cards DAY Purge card creator batches last added to more than DAYS days ago. |
95 |
|
95 |
|
96 |
USAGE |
96 |
USAGE |
97 |
exit $_[0]; |
97 |
exit $_[0]; |
Lines 490-516
if ($pTransfers) {
Link Here
|
490 |
} |
490 |
} |
491 |
|
491 |
|
492 |
if ($labels) { |
492 |
if ($labels) { |
493 |
print "Purging label items older than $labels days from batches.\n" if $verbose; |
493 |
print "Purging item label batches last added to more than $labels days ago.\n" if $verbose; |
494 |
$sth = $dbh->prepare( |
494 |
$sth = $dbh->prepare( |
495 |
q{ |
495 |
q{ |
496 |
DELETE FROM creator_batches |
496 |
DELETE from creator_batches |
497 |
WHERE timestamp < date_sub(curdate(), interval ? day) AND creator='Labels' |
497 |
WHERE batch_id in |
|
|
498 |
(SELECT batch_id |
499 |
FROM (SELECT batch_id |
500 |
FROM creator_batches |
501 |
WHERE creator='labels' |
502 |
GROUP BY batch_id |
503 |
HAVING max(timestamp) < date_sub(curdate(),interval ? day)) a) |
498 |
} |
504 |
} |
499 |
); |
505 |
); |
500 |
$sth->execute($labels) or die $dbh->errstr; |
506 |
$sth->execute($labels) or die $dbh->errstr; |
501 |
print "Done with purging label items older than $labels days from batches.\n" if $verbose; |
507 |
print "Done with purging item label batches last added to more than $labels days ago.\n" if $verbose; |
502 |
} |
508 |
} |
503 |
|
509 |
|
504 |
if ($cards) { |
510 |
if ($cards) { |
505 |
print "Purging card creator patrons older than $cards days from batches.\n" if $verbose; |
511 |
print "Purging card creator batches last added to more than $cards days ago.\n" if $verbose; |
506 |
$sth = $dbh->prepare( |
512 |
$sth = $dbh->prepare( |
507 |
q{ |
513 |
q{ |
508 |
DELETE FROM creator_batches |
514 |
DELETE from creator_batches |
509 |
WHERE timestamp < date_sub(curdate(), interval ? day) AND creator='Patroncards' |
515 |
WHERE batch_id in |
|
|
516 |
(SELECT batch_id |
517 |
FROM (SELECT batch_id |
518 |
FROM creator_batches |
519 |
WHERE creator='patroncards' |
520 |
GROUP BY batch_id |
521 |
HAVING max(timestamp) < date_sub(curdate(),interval ? day)) a); |
510 |
} |
522 |
} |
511 |
); |
523 |
); |
512 |
$sth->execute($cards) or die $dbh->errstr; |
524 |
$sth->execute($cards) or die $dbh->errstr; |
513 |
print "Done with purging card creator patrons older than $cards days from batches.\n" if $verbose; |
525 |
print "Done with purging card creator batches last added to more than $cards days ago.\n" if $verbose; |
514 |
} |
526 |
} |
515 |
|
527 |
|
516 |
exit(0); |
528 |
exit(0); |
517 |
- |
|
|