View | Details | Raw Unified | Return to bug 15563
Collapse All | Expand All

(-)a/misc/cronjobs/cleanup_database.pl (-1 / +17 lines)
Lines 90-95 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.
94
93
USAGE
95
USAGE
94
    exit $_[0];
96
    exit $_[0];
95
}
97
}
Lines 122-127 my $pDeletedPatrons; Link Here
122
my $pOldIssues;
124
my $pOldIssues;
123
my $pOldReserves;
125
my $pOldReserves;
124
my $pTransfers;
126
my $pTransfers;
127
my $labels;
125
128
126
GetOptions(
129
GetOptions(
127
    'h|help'            => \$help,
130
    'h|help'            => \$help,
Lines 152-157 GetOptions( Link Here
152
    'old-issues:i'      => \$pOldIssues,
155
    'old-issues:i'      => \$pOldIssues,
153
    'old-reserves:i'    => \$pOldReserves,
156
    'old-reserves:i'    => \$pOldReserves,
154
    'transfers:i'    => \$pTransfers,
157
    'transfers:i'    => \$pTransfers,
158
    'labels:i'            => \$labels,
155
) || usage(1);
159
) || usage(1);
156
160
157
# Use default values
161
# Use default values
Lines 192-197 unless ( $sessions Link Here
192
    || $pOldIssues
196
    || $pOldIssues
193
    || $pOldReserves
197
    || $pOldReserves
194
    || $pTransfers
198
    || $pTransfers
199
    || $labels
195
) {
200
) {
196
    print "You did not specify any cleanup work for the script to do.\n\n";
201
    print "You did not specify any cleanup work for the script to do.\n\n";
197
    usage(1);
202
    usage(1);
Lines 480-485 if ($pTransfers) { Link Here
480
    print "Done with purging transfers.\n" if $verbose;
485
    print "Done with purging transfers.\n" if $verbose;
481
}
486
}
482
487
488
if ($labels) {
489
    print "Purging label items older than $labels days from batches.\n" if $verbose;
490
    $sth = $dbh->prepare(
491
        q{
492
            DELETE FROM creator_batches
493
            WHERE timestamp < date_sub(curdate(), interval ? day) AND creator='Labels'
494
        }
495
    );
496
    $sth->execute($labels) or die $dbh->errstr;
497
    print "Done with purging label items older than $labels days from batches.\n" if $verbose;
498
}
499
483
exit(0);
500
exit(0);
484
501
485
sub RemoveOldSessions {
502
sub RemoveOldSessions {
486
- 

Return to bug 15563