diff options
author | Jonathan Prykop <jonathan@freeside.biz> | 2015-04-13 17:59:12 -0500 |
---|---|---|
committer | Jonathan Prykop <jonathan@freeside.biz> | 2015-04-13 18:11:50 -0500 |
commit | 03c9f5e33216c503fb52dc02826426b17f01f629 (patch) | |
tree | f87395a82379a4ed254a4a9f8ec620850b78f487 /FS/FS | |
parent | 17a25e030a9ba4123eecb20413465aabe41d37cf (diff) |
RT#18834 Cacti integration [schema history fix and cleanup refactor]
Diffstat (limited to 'FS/FS')
-rw-r--r-- | FS/FS/Cron/cacti_cleanup.pm | 19 | ||||
-rw-r--r-- | FS/FS/Cron/cleanup.pm | 18 | ||||
-rw-r--r-- | FS/FS/Schema.pm | 2 |
3 files changed, 18 insertions, 21 deletions
diff --git a/FS/FS/Cron/cacti_cleanup.pm b/FS/FS/Cron/cacti_cleanup.pm deleted file mode 100644 index f86262790..000000000 --- a/FS/FS/Cron/cacti_cleanup.pm +++ /dev/null @@ -1,19 +0,0 @@ -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; diff --git a/FS/FS/Cron/cleanup.pm b/FS/FS/Cron/cleanup.pm index 4c5cff278..6ec401398 100644 --- a/FS/FS/Cron/cleanup.pm +++ b/FS/FS/Cron/cleanup.pm @@ -2,8 +2,9 @@ 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 { @@ -15,4 +16,19 @@ 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; diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index 2b025c736..794f56645 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -197,7 +197,7 @@ sub dbdef_dist { && ! /^legacy_cust_history$/ && ( ! /^queue(_arg|_depend|_stat)?$/ || ! $opt->{'queue-no_history'} ) && ! $tables_hashref_torrus->{$_} - && ! /^cacti_graph$/ + && ! /^cacti_page$/ } $dbdef->tables ) { |