Lines 44-50
use Koha::UploadedFiles;
Link Here
|
44 |
|
44 |
|
45 |
sub usage { |
45 |
sub usage { |
46 |
print STDERR <<USAGE; |
46 |
print STDERR <<USAGE; |
47 |
Usage: $0 [-h|--help] [--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 ] |
47 |
Usage: $0 [-h|--help] [--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] |
48 |
|
48 |
|
49 |
-h --help prints this help message, and exits, ignoring all |
49 |
-h --help prints this help message, and exits, ignoring all |
50 |
other options |
50 |
other options |
Lines 84-89
Usage: $0 [-h|--help] [--sessions] [--sessdays DAYS] [-v|--verbose] [--zebraqueu
Link Here
|
84 |
--temp-uploads Delete temporary uploads. |
84 |
--temp-uploads Delete temporary uploads. |
85 |
--temp-uploads-days DAYS Override the corresponding preference value. |
85 |
--temp-uploads-days DAYS Override the corresponding preference value. |
86 |
--uploads-missing FLAG Delete upload records for missing files when FLAG is true, count them otherwise |
86 |
--uploads-missing FLAG Delete upload records for missing files when FLAG is true, count them otherwise |
|
|
87 |
--statistics DAYS Purge entries from statistics older than DAYS days. |
87 |
USAGE |
88 |
USAGE |
88 |
exit $_[0]; |
89 |
exit $_[0]; |
89 |
} |
90 |
} |
Lines 109-114
my $special_holidays_days;
Link Here
|
109 |
my $temp_uploads; |
110 |
my $temp_uploads; |
110 |
my $temp_uploads_days; |
111 |
my $temp_uploads_days; |
111 |
my $uploads_missing; |
112 |
my $uploads_missing; |
|
|
113 |
my $pStatistics; |
112 |
|
114 |
|
113 |
GetOptions( |
115 |
GetOptions( |
114 |
'h|help' => \$help, |
116 |
'h|help' => \$help, |
Lines 132-137
GetOptions(
Link Here
|
132 |
'temp-uploads' => \$temp_uploads, |
134 |
'temp-uploads' => \$temp_uploads, |
133 |
'temp-uploads-days:i' => \$temp_uploads_days, |
135 |
'temp-uploads-days:i' => \$temp_uploads_days, |
134 |
'uploads-missing:i' => \$uploads_missing, |
136 |
'uploads-missing:i' => \$uploads_missing, |
|
|
137 |
'statistics:i' => \$pStatistics, |
135 |
) || usage(1); |
138 |
) || usage(1); |
136 |
|
139 |
|
137 |
# Use default values |
140 |
# Use default values |
Lines 165-170
unless ( $sessions
Link Here
|
165 |
|| $special_holidays_days |
168 |
|| $special_holidays_days |
166 |
|| $temp_uploads |
169 |
|| $temp_uploads |
167 |
|| defined $uploads_missing |
170 |
|| defined $uploads_missing |
|
|
171 |
|| $pStatistics |
168 |
) { |
172 |
) { |
169 |
print "You did not specify any cleanup work for the script to do.\n\n"; |
173 |
print "You did not specify any cleanup work for the script to do.\n\n"; |
170 |
usage(1); |
174 |
usage(1); |
Lines 336-341
if( defined $uploads_missing ) {
Link Here
|
336 |
} |
340 |
} |
337 |
} |
341 |
} |
338 |
|
342 |
|
|
|
343 |
if ($pStatistics) { |
344 |
print "Purging statistics older than $pStatistics days.\n" if $verbose; |
345 |
$sth = $dbh->prepare( |
346 |
q{ |
347 |
DELETE FROM statistics |
348 |
WHERE datetime < DATE_SUB(CURDATE(), INTERVAL ? DAY) |
349 |
} |
350 |
); |
351 |
$sth->execute($pStatistics); |
352 |
print "Done with purging statistics.\n" if $verbose; |
353 |
} |
354 |
|
339 |
exit(0); |
355 |
exit(0); |
340 |
|
356 |
|
341 |
sub RemoveOldSessions { |
357 |
sub RemoveOldSessions { |
342 |
- |
|
|