[Rt-commit] rt branch, 4.2/shredding-links, created. rt-4.0.8-569-g4de7ab5

Ruslan Zakirov ruz at bestpractical.com
Sat Nov 24 11:19:44 EST 2012


The branch, 4.2/shredding-links has been created
        at  4de7ab5825f12610a0d297e9debdf4f013ce6973 (commit)

- Log -----------------------------------------------------------------
commit 4de7ab5825f12610a0d297e9debdf4f013ce6973
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Mon Apr 9 18:50:19 2012 +0400

    delete all links while shredding
    
    Shredder doesn't care if a link connects deleted tickets
    or not existing one, often it's actually the case.
    Override locally IsLinkValid to avoid skipping anything.

diff --git a/lib/RT/Shredder/Record.pm b/lib/RT/Shredder/Record.pm
index 2da0721..df9038f 100644
--- a/lib/RT/Shredder/Record.pm
+++ b/lib/RT/Shredder/Record.pm
@@ -142,12 +142,13 @@ sub __DependsOn
     push( @$list, $objs );
 
 # Links
-    if ( $self->can('_Links') ) {
-        # XXX: We don't use Links->Next as it's dies when object
-        #      is linked to object that doesn't exist
-        #      also, ->Next skip links to deleted tickets :(
+    if ( $self->can('Links') ) {
+        # make sure we don't skip any record
+        no warnings 'redefine';
+        local *RT::Links::IsValidLink = sub { 1 };
+
         foreach ( qw(Base Target) ) {
-            my $objs = $self->_Links( $_ );
+            my $objs = $self->Links( $_ );
             $objs->_DoSearch;
             push @$list, $objs->ItemsArrayRef;
         }
diff --git a/t/shredder/01ticket.t b/t/shredder/01ticket.t
index 60e4a7e..a65cdea 100644
--- a/t/shredder/01ticket.t
+++ b/t/shredder/01ticket.t
@@ -69,10 +69,7 @@ cmp_deeply( $test->dump_current_and_savepoint('clean'), "current DB equal to sav
     $shredder->PutObjects( Objects => $child );
     $shredder->WipeoutAll;
 
-    TODO: {
-        local $TODO = "Shredder doesn't delete all links and transactions";
-        cmp_deeply( $test->dump_current_and_savepoint('parent_ticket'), "current DB equal to savepoint");
-    }
+    cmp_deeply( $test->dump_current_and_savepoint('parent_ticket'), "current DB equal to savepoint");
 
     $shredder->PutObjects( Objects => $parent );
     $shredder->WipeoutAll;

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


More information about the Rt-commit mailing list