[freeside-commits] branch master updated. a179189cab28d3c1b7ae0101df5c1a95c4a72003

Jonathan Prykop jonathan at 420.am
Mon Apr 13 16:00:27 PDT 2015


The branch, master has been updated
       via  a179189cab28d3c1b7ae0101df5c1a95c4a72003 (commit)
       via  dd14eb402e7ed67d1f5ad63415bf169a3e79135b (commit)
      from  470878235c5f61ca7acc6ef618943071ca9736b5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit a179189cab28d3c1b7ae0101df5c1a95c4a72003
Merge: dd14eb4 4708782
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Mon Apr 13 18:00:12 2015 -0500

    Merge branch 'master' of git.freeside.biz:/home/git/freeside


commit dd14eb402e7ed67d1f5ad63415bf169a3e79135b
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Mon Apr 13 17:59:12 2015 -0500

    RT#18834 Cacti integration [schema history fix and cleanup refactor]

diff --git a/FS/FS/Cron/cacti_cleanup.pm b/FS/FS/Cron/cacti_cleanup.pm
deleted file mode 100644
index f862627..0000000
--- 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;
-
- at 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 4c5cff2..6ec4013 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 );
 
- at EXPORT_OK = qw( cleanup );
+ at 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 839a971..29bbf78 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -203,7 +203,7 @@ sub dbdef_dist {
            && ! /^legacy_cust_history$/
            && ( ! /^queue(_arg|_depend|_stat)?$/ || ! $opt->{'queue-no_history'} )
            && ! $tables_hashref_torrus->{$_}
-           && ! /^cacti_graph$/
+           && ! /^cacti_page$/
          }
       $dbdef->tables
   ) {
diff --git a/FS/bin/freeside-daily b/FS/bin/freeside-daily
index bf9f177..cb018d1 100755
--- a/FS/bin/freeside-daily
+++ b/FS/bin/freeside-daily
@@ -83,15 +83,9 @@ export_batch_submit(%opt);
 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
@@ -99,7 +93,6 @@ use FS::Cron::backup qw(backup);
 backup();
 
 #except we'd rather not start cleanup jobs until the backup is done
-use FS::Cron::cleanup qw(cleanup);
 cleanup();
 
 $log->info('finish');

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/Cron/cacti_cleanup.pm |   19 -------------------
 FS/FS/Cron/cleanup.pm       |   18 +++++++++++++++++-
 FS/FS/Schema.pm             |    2 +-
 FS/bin/freeside-daily       |   13 +++----------
 4 files changed, 21 insertions(+), 31 deletions(-)
 delete mode 100644 FS/FS/Cron/cacti_cleanup.pm




More information about the freeside-commits mailing list