[Rt-commit] rt branch, 4.2/record-attachments-insert-failure, created. rt-4.2.5-167-gf357949
? sunnavy
sunnavy at bestpractical.com
Wed Oct 1 09:57:13 EDT 2014
The branch, 4.2/record-attachments-insert-failure has been created
at f357949c5a0e03089a63945d68febf9e2b98cfae (commit)
- Log -----------------------------------------------------------------
commit f357949c5a0e03089a63945d68febf9e2b98cfae
Author: sunnavy <sunnavy at bestpractical.com>
Date: Wed Oct 1 10:14:21 2014 +0800
record attachment insert error to txn
Fixes: #30419
diff --git a/lib/RT/Attachment.pm b/lib/RT/Attachment.pm
index 4c5322f..f5fee0d 100644
--- a/lib/RT/Attachment.pm
+++ b/lib/RT/Attachment.pm
@@ -177,6 +177,7 @@ sub Create {
unless ($id) {
$RT::Logger->crit("Attachment insert failed - ". $RT::Handle->dbh->errstr);
+ $self->TransactionObj->Object->_NewTransaction( Type => 'AttachmentError', ActivateScrips => 0, Data => $Filename, NewValue => substr($RT::Handle->dbh->errstr,0,255) );
return ($id);
}
@@ -221,6 +222,7 @@ sub Create {
}
else {
$RT::Logger->crit("Attachment insert failed: ". $RT::Handle->dbh->errstr);
+ $self->TransactionObj->Object->_NewTransaction( Type => 'AttachmentError', ActivateScrips => 0, Data => $Filename, NewValue => substr($RT::Handle->dbh->errstr,0,255) );
}
return $id;
}
diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index 5ef69c6..aa57946 100644
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -1797,6 +1797,7 @@ our %TRANSACTION_CLASSIFICATION = (
SystemError => 'error',
AttachmentTruncate => 'attachment-truncate',
AttachmentDrop => 'attachment-drop',
+ AttachmentError => 'error',
__default => 'other',
);
diff --git a/lib/RT/Transaction.pm b/lib/RT/Transaction.pm
index ae97628..93a6fa9 100644
--- a/lib/RT/Transaction.pm
+++ b/lib/RT/Transaction.pm
@@ -863,6 +863,15 @@ sub _FormatUser {
$self->OldValue, $self->NewValue ); #loc()
}
},
+ AttachmentError => sub {
+ my $self = shift;
+ if ( defined $self->Data ) {
+ return ( "File '[_1]' insert failed because [_2].", $self->Data, $self->NewValue ); #loc()
+ }
+ else {
+ return ( "Content insert failed because [_1].", $self->NewValue ); #loc()
+ }
+ },
"Forward Transaction" => sub {
my $self = shift;
my $recipients = join ", ", map {
-----------------------------------------------------------------------
More information about the rt-commit
mailing list