[Rt-commit] r5759 - in rt/branches/3.7-EXPERIMENTAL: .

ruz at bestpractical.com ruz at bestpractical.com
Sat Aug 12 01:19:31 EDT 2006


Author: ruz
Date: Sat Aug 12 01:19:30 2006
New Revision: 5759

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/sbin/rt-shredder.in

Log:
 r3643 at cubic-pc:  cubic | 2006-08-12 09:26:09 +0400
 * proce dump plugins too


Modified: rt/branches/3.7-EXPERIMENTAL/sbin/rt-shredder.in
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/sbin/rt-shredder.in	(original)
+++ rt/branches/3.7-EXPERIMENTAL/sbin/rt-shredder.in	Sat Aug 12 01:19:30 2006
@@ -195,26 +195,42 @@
 			print STDERR "Error: $msg\n";
 			exit(1);
 		}
-		
-		my @objs = ();
-		($status, @objs) = $plugin->Run;
-		unless( $status ) {
-			print STDERR "Couldn't run plugin\n";
-			print STDERR "Error: $objs[1]\n";
-			exit(1);
-		}
-
-		($status, $msg) = $plugin->SetResolvers( Shredder => $shredder );
-		unless( $status ) {
-			print STDERR "Couldn't set conflicts resolver\n";
-			print STDERR "Error: $msg\n";
-			exit(1);
-		}
-		push @res, @objs;
+        if ( lc $plugin->Type eq 'search' ) {
+            push @res, _process_search_plugin( $shredder, $plugin );
+        }
+        elsif ( lc $plugin->Type eq 'dump' ) {
+            _process_dump_plugin( $shredder, $plugin );
+        }
 	}
 	return RT::Shredder->CastObjectsToRecords( Objects => \@res );
 }
 
+sub _process_search_plugin {
+    my ($shredder, $plugin) = @_;
+    my ($status, @objs) = $plugin->Run;
+    unless( $status ) {
+        print STDERR "Couldn't run plugin\n";
+        print STDERR "Error: $objs[1]\n";
+        exit(1);
+    }
+
+    my $msg;
+    ($status, $msg) = $plugin->SetResolvers( Shredder => $shredder );
+    unless( $status ) {
+        print STDERR "Couldn't set conflicts resolver\n";
+        print STDERR "Error: $msg\n";
+        exit(1);
+    }
+    return @objs;
+}
+
+sub _process_dump_plugin {
+    my ($shredder, $plugin) = @_;
+    $shredder->AddDumpPlugin(
+        Object => $plugin,
+    );
+}
+
 sub show_plugin_list
 {
 	print "Plugins list:\n";


More information about the Rt-commit mailing list