Lines 690-696
if ($cards) {
Link Here
|
690 |
|
690 |
|
691 |
if ($background_days) { |
691 |
if ($background_days) { |
692 |
print "Purging background jobs more than $background_days days ago.\n" if $verbose; |
692 |
print "Purging background jobs more than $background_days days ago.\n" if $verbose; |
693 |
my $count = PurgeBackgroundJobs($background_days, \@background_types, $confirm); |
693 |
my $params = { job_types => \@background_types , |
|
|
694 |
days => $background_days, |
695 |
confirm => $confirm, |
696 |
}; |
697 |
my $count = Koha::BackgroundJobs->purge( $params ); |
694 |
if ($verbose) { |
698 |
if ($verbose) { |
695 |
say $confirm |
699 |
say $confirm |
696 |
? sprintf "Done with purging %d background jobs of type(s): %s added more than %d days ago.\n", $count, join(',', @background_types), $background_days |
700 |
? sprintf "Done with purging %d background jobs of type(s): %s added more than %d days ago.\n", $count, join(',', @background_types), $background_days |
Lines 836-862
sub DeleteSpecialHolidays {
Link Here
|
836 |
print "Removed $count unique holidays\n" if $verbose; |
840 |
print "Removed $count unique holidays\n" if $verbose; |
837 |
} |
841 |
} |
838 |
|
842 |
|
839 |
sub PurgeBackgroundJobs { |
|
|
840 |
my ( $days, $types, $confirm ) = @_; |
841 |
|
842 |
my $rs; |
843 |
if ( $types->[0] eq 'all' ){ |
844 |
$rs = Koha::BackgroundJobs->search( |
845 |
{ |
846 |
ended_on => { '<' => \[ 'date_sub(curdate(), INTERVAL ? DAY)', $days ] }, |
847 |
status => 'finished', |
848 |
}); |
849 |
|
850 |
} else { |
851 |
$rs = Koha::BackgroundJobs->search( |
852 |
{ |
853 |
ended_on => { '<' => \[ 'date_sub(curdate(), INTERVAL ? DAY)', $days ] }, |
854 |
type => \@{$types}, |
855 |
status => 'finished', |
856 |
}); |
857 |
} |
858 |
my $count = $rs->count(); |
859 |
$rs->delete if $confirm; |
860 |
|
861 |
return $count; |
862 |
} |
863 |
- |