[Rt-commit] [svn] r727 - in rt/branches/rt-3.1: . lib/RT
jesse at pallas.eruditorum.org
jesse at pallas.eruditorum.org
Thu Apr 22 01:29:35 EDT 2004
Author: jesse
Date: Thu Apr 22 01:29:34 2004
New Revision: 727
Modified:
rt/branches/rt-3.1/ (props changed)
rt/branches/rt-3.1/lib/RT/EmailParser.pm
rt/branches/rt-3.1/lib/RT/Template_Overlay.pm
Log:
----------------------------------------------------------------------
r2126 at tinbook: jesse | 2004-04-22T05:29:11.407088Z
RT is now better about cleaning up tempfiles it creates
----------------------------------------------------------------------
Modified: rt/branches/rt-3.1/lib/RT/EmailParser.pm
==============================================================================
--- rt/branches/rt-3.1/lib/RT/EmailParser.pm (original)
+++ rt/branches/rt-3.1/lib/RT/EmailParser.pm Thu Apr 22 01:29:34 2004
@@ -183,7 +183,7 @@
close($fh);
if ( -f $temp_file ) {
$self->ParseMIMEEntityFromFile($temp_file, $args{'Decode'});
- File::Temp::unlink0( $fh, $temp_file );
+ unlink($temp_file );
}
} #If for some reason we weren't able to parse the message using a temp file # try it with a scalar
if ( !$self->Entity ) {
@@ -628,10 +628,10 @@
sub _SetupMIMEParser {
my $self = shift;
my $parser = shift;
- my $AttachmentDir = File::Temp::tempdir( TMPDIR => 1, CLEANUP => 1 );
+ $self->{'AttachmentDir'} ||= File::Temp::tempdir( TMPDIR => 1, CLEANUP => 1 );
# Set up output directory for files:
- $parser->output_dir("$AttachmentDir");
+ $parser->output_dir($self->{'AttachmentDir'});
$parser->filer->ignore_filename(1);
@@ -647,8 +647,16 @@
$parser->output_to_core(0);
}
+
# }}}
+sub DESTROY {
+ my $self = shift;
+ File::Path::rmtree([$self->{'AttachmentDir'}],0,1);
+}
+
+
+
eval "require RT::EmailParser_Vendor";
die $@ if ($@ && $@ !~ qr{^Can't locate RT/EmailParser_Vendor.pm});
eval "require RT::EmailParser_Local";
Modified: rt/branches/rt-3.1/lib/RT/Template_Overlay.pm
==============================================================================
--- rt/branches/rt-3.1/lib/RT/Template_Overlay.pm (original)
+++ rt/branches/rt-3.1/lib/RT/Template_Overlay.pm Thu Apr 22 01:29:34 2004
@@ -318,20 +318,9 @@
my $parser = MIME::Parser->new();
- # Setup output directory for files. from RT::EmailParser::_SetupMIMEParser
- if ( my $AttachmentDir =
- eval { File::Temp::tempdir( TMPDIR => 1, CLEANUP => 1 ) } )
- {
-
- # Set up output directory for files:
- $parser->output_dir("$AttachmentDir");
- }
- else {
- $RT::Logger->error("Couldn't write attachments to temp dir on disk. using more memory and processor.");
# On some situations TMPDIR is non-writable. sad but true.
$parser->output_to_core(1);
$parser->tmp_to_core(1);
- }
#If someone includes a message, don't extract it
$parser->extract_nested_messages(1);
@@ -415,4 +404,5 @@
}
# }}}
+
1;
More information about the Rt-commit
mailing list