Lines 26-39
use C4::Suggestions;
Link Here
|
26 |
use C4::Log qw( cronlogaction ); |
26 |
use C4::Log qw( cronlogaction ); |
27 |
use C4::Context; |
27 |
use C4::Context; |
28 |
|
28 |
|
29 |
my ( $help, $days, $confirm ); |
29 |
my ( $help, $days, $confirm, $verbose ); |
30 |
|
30 |
|
31 |
my $command_line_options = join(" ",@ARGV); |
31 |
my $command_line_options = join(" ",@ARGV); |
|
|
32 |
cronlogaction({ info => $command_line_options }); |
32 |
|
33 |
|
33 |
GetOptions( |
34 |
GetOptions( |
34 |
'help|?' => \$help, |
35 |
'help|?' => \$help, |
35 |
'days:i' => \$days, |
36 |
'days:i' => \$days, |
36 |
'confirm'=> \$confirm, |
37 |
'confirm' => \$confirm, |
|
|
38 |
'v|verbose' => \$verbose, |
37 |
); |
39 |
); |
38 |
|
40 |
|
39 |
my $usage = << 'ENDUSAGE'; |
41 |
my $usage = << 'ENDUSAGE'; |
Lines 42-47
Parameters:
Link Here
|
42 |
-help|? This message |
44 |
-help|? This message |
43 |
-days TTT to define the age of suggestions to delete |
45 |
-days TTT to define the age of suggestions to delete |
44 |
-confirm flag needed to confirm purge operation |
46 |
-confirm flag needed to confirm purge operation |
|
|
47 |
-verbose flag to increase feedback |
45 |
|
48 |
|
46 |
The days parameter falls back to the value of system preference |
49 |
The days parameter falls back to the value of system preference |
47 |
PurgeSuggestionsOlderThan. Suggestions are deleted only for a positive |
50 |
PurgeSuggestionsOlderThan. Suggestions are deleted only for a positive |
Lines 59-66
if( !$confirm || $help || !defined($days) ) {
Link Here
|
59 |
print "No confirm parameter passed!\n\n" if !$confirm && !$help; |
62 |
print "No confirm parameter passed!\n\n" if !$confirm && !$help; |
60 |
print $usage; |
63 |
print $usage; |
61 |
} elsif( $days and $days > 0 ) { |
64 |
} elsif( $days and $days > 0 ) { |
62 |
$command_line_options .= " ( effective days = $days )"; |
65 |
print "Purging suggestions older than $days days\n" if $verbose; |
63 |
cronlogaction({ info => $command_line_options }); |
|
|
64 |
DelSuggestionsOlderThan($days); |
66 |
DelSuggestionsOlderThan($days); |
65 |
} else { |
67 |
} else { |
66 |
warn "This script requires a positive number of days. Aborted.\n"; |
68 |
warn "This script requires a positive number of days. Aborted.\n"; |