[freeside-commits] branch master updated. 42cb05f8b363d8f56ff620256adcaf1a4f15046f

Ivan ivan at 420.am
Tue Sep 10 15:21:35 PDT 2013


The branch, master has been updated
       via  42cb05f8b363d8f56ff620256adcaf1a4f15046f (commit)
      from  7360c297b80cd26e375149bb12393dc7e7674f1e (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 42cb05f8b363d8f56ff620256adcaf1a4f15046f
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue Sep 10 15:21:34 2013 -0700

    add queue-no_history config option, RT#20345

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index d8c2317..d63c12f 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -4896,6 +4896,13 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'queue-no_history',
+    'section'     => '',
+    'description' => "Don't recreate the h_queue and h_queue_arg tables on upgrades.  This can save disk space for large installs, especially when using prepaid or multi-process billing.  After turning this option on, drop the h_queue and h_queue_arg tables, run freeside-dbdef-create and restart Apache and Freeside.",
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'cancelled_cust-noevents',
     'section'     => 'billing',
     'description' => "Don't run events for cancelled customers",
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index 95b2cc5..45c0b7a 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -7,6 +7,7 @@ use DBIx::DBSchema 0.40; #0.40 for mysql upgrade fixes
 use DBIx::DBSchema::Table;
 use DBIx::DBSchema::Column;
 use DBIx::DBSchema::Index;
+#can't use this yet, dependency bs #use FS::Conf;
 
 @ISA = qw(Exporter);
 @EXPORT_OK = qw( dbdef dbdef_dist reload_dbdef );
@@ -75,7 +76,8 @@ Currently, this enables "ENGINE=InnoDB" for MySQL databases.
 =cut
 
 sub dbdef_dist {
-  my $datasrc = @_ ? shift : '';
+  my $datasrc = @_ && !ref($_[0]) ? shift : '';
+  my $opt = @_ ? shift : {};
   
   my $local_options = '';
   if ( $datasrc =~ /^dbi:mysql/i ) {
@@ -192,6 +194,7 @@ sub dbdef_dist {
     grep {    ! /^(clientapi|access_user)_session/
            && ! /^h_/
            && ! /^log(_context)?$/
+           && ( ! /^queue(_arg)?$/ || ! $opt->{'queue-no_history'} )
            && ! $tables_hashref_torrus->{$_}
          }
       $dbdef->tables
diff --git a/FS/bin/freeside-upgrade b/FS/bin/freeside-upgrade
index 5bd1415..06ec962 100755
--- a/FS/bin/freeside-upgrade
+++ b/FS/bin/freeside-upgrade
@@ -107,7 +107,14 @@ if ( $DRY_RUN ) {
 #from 1.3 to 1.4... if not, it needs to be hooked into -upgrade here or
 #you'll lose all the part_svc settings it migrates to part_svc_column
 
-my @statements = dbdef->sql_update_schema( dbdef_dist(datasrc),
+my $conf = new FS::Conf;
+
+my $dbdef_dist = dbdef_dist(
+  datasrc,
+  { 'queue-no_history' => $conf->exists('queue-no_history') },
+);
+
+my @statements = dbdef->sql_update_schema( $dbdef_dist,
                                            $dbh,
                                            { 'nullify_default' => 1, },
                                          );

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

Summary of changes:
 FS/FS/Conf.pm           |    7 +++++++
 FS/FS/Schema.pm         |    5 ++++-
 FS/bin/freeside-upgrade |    9 ++++++++-
 3 files changed, 19 insertions(+), 2 deletions(-)




More information about the freeside-commits mailing list