[freeside-commits] branch FREESIDE_3_BRANCH updated. 493a5911544a638665eab5096425fd6785e9fe0b

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


The branch, FREESIDE_3_BRANCH has been updated
       via  493a5911544a638665eab5096425fd6785e9fe0b (commit)
      from  00e73550bcfd02777e4413b19dfa3fb5cf509024 (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 493a5911544a638665eab5096425fd6785e9fe0b
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue Sep 10 15:21:35 2013 -0700

    add queue-no_history config option, RT#20345

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index cfbf32d..2e2f7e4 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -4895,6 +4895,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 442994a..9927eb3 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_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 3d1c2e0..44e67df 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