[Rt-commit] rt branch, 4.4/rt-munge-attachments, repushed
Jim Brandt
jbrandt at bestpractical.com
Fri Nov 2 16:16:49 EDT 2018
The branch 4.4/rt-munge-attachments was deleted and repushed:
was b3a384dcc5c791f532980345221cfc64ad9906fa
now 4f1157ffcc8ecb22a9e3dce49c17a314037f4467
1: 1cf713bdb ! 1: 51b1225b6 Create ReplaceAttachments, ReplaceHeader and ReplaceContent Methods
@@ -24,15 +24,15 @@
+ my $self = shift;
+ my %args = (
+ Search => undef,
-+ Replacement => undef,
++ Replacement => '',
+ @_,
+ );
+
-+ return (0, 'Provide search string for ReplaceHeaders() to search on') unless $args{Search};
++ return (0, 'No Search string provided') unless $args{Search};
+
+ foreach my $header ($self->SplitHeaders) {
+ if ( $header =~ /\Q$args{Search}\E/ig ) {
-+ (my $tag) = ($header =~ /^([^\:]+)/);
++ (my $tag) = $header =~ /^([^\:]+)/;
+ my ( $ret, $msg ) = $self->SetHeader($tag, $args{Replacement});
+ return ($ret, $msg) unless $ret;
+ }
@@ -52,11 +52,11 @@
+ my $self = shift;
+ my %args = (
+ Search => undef,
-+ Replacement => "",
++ Replacement => '',
+ @_,
+ );
+
-+ return (0, 'Provide search string for ReplaceContent() to search on') unless $args{Search};
++ return (0, 'No search string provided') unless $args{Search};
+
+ my $content = $self->Content;
+
@@ -65,7 +65,7 @@
+ my ($ret, $msg) = $self->_Set( Field => 'Content', Value => $content );
+ return ($ret, $msg);
+ }
-+ return(1, 'No matches found in Attachments table Content column');
++ return(1, 'No content matches found');
+}
+
+
@@ -105,7 +105,7 @@
+ OPERATOR => 'LIKE',
+ VALUE => $args{Search},
+ SUBCLAUSE => 'Attachments',
-+ ) unless ! $args{Headers};
++ ) unless !$args{Headers};
+
+ $self->Limit(
+ ENTRYAGGREGATOR => 'OR',
@@ -113,20 +113,19 @@
+ OPERATOR => 'LIKE',
+ VALUE => $args{Search},
+ SUBCLAUSE => 'Attachments',
-+ ) unless ! $args{Content};
++ ) unless !$args{Content};
+
+ while (my $attachment = $self->Next) {
+ if ( $args{Headers} ) {
+ my ($ret, $msg) = $attachment->ReplaceHeaders(Search => $args{Search}, Replacement => $args{Replacement});
-+ return ($ret, $msg) unless $ret;
++ RT::Logger->error($msg) unless $ret;
+ }
+ if ( $args{Content} ) {
+ my ($ret, $msg) = $attachment->ReplaceContent(Search => $args{Search}, Replacement => $args{Replacement});
-+ return ($ret, $msg) unless $ret;
++ RT::Logger->error($msg) unless $ret;
+ }
+ }
-+ return (1, "No instances of $args{Search} where found in the attachments table") unless $self->Count;
-+ return (1, "$args{Search} has been replaced with \"$args{Replacement}\"");
++ return;
+}
+
RT::Base->_ImportOverlays();
2: e3b643124 = 2: c9cfaacec Create rt-munge-attachments executable
3: b3a384dcc = 3: 4f1157ffc Add tests for methods that munge the attachments table
More information about the rt-commit
mailing list