+++ /dev/null
-package FS::Cron::cacti_cleanup;
-use base 'Exporter';
-use vars '@EXPORT_OK';
-
-use FS::Record qw( qsearch );
-use Data::Dumper;
-
-@EXPORT_OK = qw( cacti_cleanup );
-
-sub cacti_cleanup {
- foreach my $export (qsearch({
- 'table' => 'part_export',
- 'hashref' => { 'exporttype' => 'cacti' }
- })) {
- $export->cleanup;
- }
-}
-
-1;
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 {
$job->insert('_JOB');
}
+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;
&& ! /^legacy_cust_history$/
&& ( ! /^queue(_arg|_depend|_stat)?$/ || ! $opt->{'queue-no_history'} )
&& ! $tables_hashref_torrus->{$_}
- && ! /^cacti_graph$/
+ && ! /^cacti_page$/
}
$dbdef->tables
) {
use FS::Cron::agent_email qw(agent_email);
agent_email(%opt);
-#does nothing unless there are cacti imports
-#should run before backup, no need to backup cacti imports
-use FS::Cron::cacti_cleanup qw(cacti_cleanup);
-cacti_cleanup();
-
-my $deldir = "$FS::UID::cache_dir/cache.$FS::UID::datasrc/";
-unlink <${deldir}.invoice*>;
-unlink <${deldir}.letter*>;
-unlink <${deldir}.CGItemp*>;
+#clears out cacti imports & deletes select database cache files
+use FS::Cron::cleanup qw( cleanup cleanup_before_backup );
+cleanup_before_backup();
#backup should be last
#you can skip this just by not having the config
backup();
#except we'd rather not start cleanup jobs until the backup is done
-use FS::Cron::cleanup qw(cleanup);
cleanup();
$log->info('finish');