[freeside-commits] branch master updated. e20da7110c624325f2a81a9d720d3493f7263ecc

Ivan ivan at 420.am
Fri Nov 15 18:00:11 PST 2013


The branch, master has been updated
       via  e20da7110c624325f2a81a9d720d3493f7263ecc (commit)
      from  b77fc573901a0ae334b9b382e00ca9db60401d16 (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 e20da7110c624325f2a81a9d720d3493f7263ecc
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Fri Nov 15 18:00:08 2013 -0800

    fix job queue operation with FKs, RT#13971

diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index ebf4f37..bc9d37a 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -3,7 +3,7 @@ package FS::Schema;
 use vars qw(@ISA @EXPORT_OK $DEBUG $setup_hack %dbdef_cache);
 use subs qw(reload_dbdef);
 use Exporter;
-use DBIx::DBSchema 0.43; #0.43 for foreign keys
+use DBIx::DBSchema 0.44; #for foreign keys with MATCH / ON DELETE/UPDATE
 use DBIx::DBSchema::Table;
 use DBIx::DBSchema::Column;
 use DBIx::DBSchema::Index;
@@ -3954,6 +3954,7 @@ sub tables_hashref {
       'foreign_keys' => [
                           { columns    => [ 'jobnum' ],
                             table      => 'queue',
+                            on_delete  => 'CASCADE',
                           },
                         ],
     },
@@ -3974,6 +3975,7 @@ sub tables_hashref {
                           { columns    => [ 'depend_jobnum' ],
                             table      => 'queue',
                             references => [ 'jobnum' ],
+                            on_delete  => 'CASCADE',
                           },
                         ],
     },
diff --git a/FS/FS/queue.pm b/FS/FS/queue.pm
index 3f8763d..8ebadd4 100644
--- a/FS/FS/queue.pm
+++ b/FS/FS/queue.pm
@@ -193,20 +193,6 @@ deleted as well
 sub delete {
   my $self = shift;
 
-  local $SIG{HUP} = 'IGNORE';
-  local $SIG{INT} = 'IGNORE';
-  local $SIG{QUIT} = 'IGNORE';
-  local $SIG{TERM} = 'IGNORE';
-  local $SIG{TSTP} = 'IGNORE';
-  local $SIG{PIPE} = 'IGNORE';
-
-  my $oldAutoCommit = $FS::UID::AutoCommit;
-  local $FS::UID::AutoCommit = 0;
-  my $dbh = dbh;
-
-  my @del = qsearch( 'queue_arg', { 'jobnum' => $self->jobnum } );
-  push @del, qsearch( 'queue_depend', { 'depend_jobnum' => $self->jobnum } );
-
   my $reportname = '';
   if ( $self->status =~/^done/ ) {
     my $dropstring = rooturl(). '/misc/queued_report\?report=';
@@ -216,20 +202,7 @@ sub delete {
   }
 
   my $error = $self->SUPER::delete;
-  if ( $error ) {
-    $dbh->rollback if $oldAutoCommit;
-    return $error;
-  }
-
-  foreach my $del ( @del ) {
-    $error = $del->delete;
-    if ( $error ) {
-      $dbh->rollback if $oldAutoCommit;
-      return $error;
-    }
-  }
-
-  $dbh->commit or die $dbh->errstr if $oldAutoCommit;
+  return $error if $error;
   
   unlink $reportname if $reportname;
 

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

Summary of changes:
 FS/FS/Schema.pm |    4 +++-
 FS/FS/queue.pm  |   29 +----------------------------
 2 files changed, 4 insertions(+), 29 deletions(-)




More information about the freeside-commits mailing list