X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FCron%2Fcleanup.pm;h=9d0c067408fa31d9f8a7b54c0820453012bcbed4;hb=09af85fc0e7a48392c930c9672a99448cf9630d4;hp=4c5cff27859f8f1ad19737f548b8e729d46107a5;hpb=e6210bad824b2efc0a2d54abe8fc79093e7cc5ed;p=freeside.git diff --git a/FS/FS/Cron/cleanup.pm b/FS/FS/Cron/cleanup.pm index 4c5cff278..9d0c06740 100644 --- a/FS/FS/Cron/cleanup.pm +++ b/FS/FS/Cron/cleanup.pm @@ -2,17 +2,47 @@ package FS::Cron::cleanup; use base 'Exporter'; use vars '@EXPORT_OK'; use FS::queue; +use FS::Record qw( qsearch ); -@EXPORT_OK = qw( cleanup ); +@EXPORT_OK = qw( cleanup cleanup_before_backup ); # start janitor jobs sub cleanup { -# fix locations that are missing coordinates + my %opt = @_; + + # fix locations that are missing coordinates my $job = FS::queue->new({ 'job' => 'FS::cust_location::process_set_coord', 'status' => 'new' }); $job->insert('_JOB'); + + # check card number tokenization + $job = FS::queue->new({ + 'job' => 'FS::cust_main::Billing_Realtime::token_check', + 'status' => 'new' + }); + $job->insert( + %opt, + 'queue' => 1, + 'daily' => 1, + ); + +} + +sub cleanup_before_backup { + #remove outdated cacti_page entries + foreach my $export (qsearch({ + 'table' => 'part_export', + 'hashref' => { 'exporttype' => 'cacti' } + })) { + $export->cleanup; + } + #remove cache files + my $deldir = "$FS::UID::cache_dir/cache.$FS::UID::datasrc/"; + unlink <${deldir}.invoice*>; + unlink <${deldir}.letter*>; + unlink <${deldir}.CGItemp*>; } 1;