[Rt-commit] rt branch, 4.4/rt-munge-attachments, repushed

Craig Kaiser craig at bestpractical.com
Tue Dec 4 10:58:58 EST 2018


The branch 4.4/rt-munge-attachments was deleted and repushed:
       was 64ebf36fc2cfb5cd3dcb4766176aea698506de4d
       now 381ff697bad73f25d2d73d1d3e3b30bea8e9f0c0

1: 34bcb0e99 ! 1: 16f7ff022 Create ReplaceAttachments, ReplaceHeader and ReplaceContent Methods
    @@ -130,20 +130,20 @@
     +        if ( $args{Headers} ) {
     +            ($ret, $msg) = $attachment->ReplaceHeaders(Search => $args{Search}, Replacement => $args{Replacement});
     +            RT::Logger->error($msg) unless $ret;
    -+            $content_replaced = $ret || $content_replaced;
    ++            $content_replaced = $ret ||= $content_replaced;
     +        }
    -+        return ($ret, $msg) unless $ret;
    ++        RT::Logger->error($msg) unless $ret;
     +        if ( $args{Content} ) {
     +            ($ret, $msg) = $attachment->ReplaceContent(Search => $args{Search}, Replacement => $args{Replacement});
     +            RT::Logger->error($msg) unless $ret;
    -+            $content_replaced = $ret || $content_replaced;
    ++            $content_replaced = $ret ||= $content_replaced;
     +        }
    -+        return ($ret, $msg) unless $ret;
    ++        RT::Logger->error($msg) unless $ret;
     +        my $ticket = $attachment->TransactionObj->TicketObj;
     +        $tickets{$ticket->Id} ||= $ticket if $content_replaced;
     +    }
    -+    foreach my $ticket (values %tickets){
    -+        (my $trans, $msg) = $ticket->_NewTransaction(
    ++     foreach my $id ( sort { $a <=> $b } keys %tickets ) {
    ++        (my $trans, $msg) = $tickets{$id}->_NewTransaction (
     +            Type     => "Munge",
     +        );
     +        RT::Logger->error($msg) unless $trans;
    @@ -156,3 +156,18 @@
      
      1;
     
    +diff --git a/lib/RT/Transaction.pm b/lib/RT/Transaction.pm
    +--- a/lib/RT/Transaction.pm
    ++++ b/lib/RT/Transaction.pm
    +@@
    +         $principal->Load($self->Field);
    +         return ("Removed from group '[_1]'", $principal->Object->Name); #loc()
    +     },
    ++    Munge => sub {
    ++        my $self = shift;
    ++        return "Attachment content modified";
    ++    },
    + );
    + 
    + 
    +
2: df92eea70 ! 2: 99969db30 Create rt-munge-attachments executable
    @@ -125,18 +125,15 @@
     +
     +use RT -init;
     +
    -+if ( $opts{'search'} ) {
    -+    my $replacement = $opts{'replacement'} || '';
    ++my $replacement = $opts{'replacement'} || '';
     +
    -+    my $search = $opts{'search'};
    ++my $search = $opts{'search'};
     +
    -+    my $attachments = RT::Attachments->new( RT->SystemUser );
    -+    my ($ret, $msg) = $attachments->ReplaceAttachments(Search => $search, Replacement => $replacement);
    ++my $attachments = RT::Attachments->new( RT->SystemUser );
    ++my ($ret, $msg) = $attachments->ReplaceAttachments(Search => $search, Replacement => $replacement);
     +
    -+    print STDERR $msg . "\n";
    -+} else {
    -+    print STDERR "Provide a search string \n";
    -+}
    ++print STDERR $msg . "\n";
    ++
     +
     +=head1 rt-munge-attachments
     +
3: 521d6783e < -:  ------- Add new transaction type for munging attachments
4: 64ebf36fc = 3: 381ff697b Add tests for methods that munge the attachments table



More information about the rt-commit mailing list