summaryrefslogtreecommitdiff
path: root/fml/lib
diff options
context:
space:
mode:
authorfukachan <fukachan>2004-12-15 13:53:52 +0000
committerfukachan <fukachan>2004-12-15 13:53:52 +0000
commit11450a40059b2b103259eb0fe180c94d1ca3167b (patch)
tree4df126c2893891b07d003d6ca558cd3d662ba72d /fml/lib
parent47bea17ae6e2ed9d78e8931ac45ad5234434f73b (diff)
downloadfml8-11450a40059b2b103259eb0fe180c94d1ca3167b.tar.gz
fml8-11450a40059b2b103259eb0fe180c94d1ca3167b.tar.bz2
fml8-11450a40059b2b103259eb0fe180c94d1ca3167b.zip
remove too old files in tmp/ and var/mail/queue/incoming/ directories.
Diffstat (limited to 'fml/lib')
-rw-r--r--fml/lib/FML/Process/Kernel.pm25
1 files changed, 24 insertions, 1 deletions
diff --git a/fml/lib/FML/Process/Kernel.pm b/fml/lib/FML/Process/Kernel.pm
index f5f8ea7e..88414d1f 100644
--- a/fml/lib/FML/Process/Kernel.pm
+++ b/fml/lib/FML/Process/Kernel.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: Kernel.pm,v 1.245 2004/12/05 16:19:10 fukachan Exp $
+# $FML: Kernel.pm,v 1.246 2004/12/09 04:53:42 fukachan Exp $
#
package FML::Process::Kernel;
@@ -2656,6 +2656,15 @@ sub clean_up_tmpfiles
unlink $q;
}
}
+
+ # clean up tmp_dir.
+ my $channel = "clean_up_tmp_dir";
+ if ($curproc->is_event_timeout($channel)) {
+ my $config = $curproc->config();
+ my $tmp_dir = $config->{ tmp_dir };
+ $curproc->remove_too_old_files_in_dir($tmp_dir);
+ $curproc->set_event_timeout($channel, time + 24*3600);
+ }
}
@@ -2666,12 +2675,26 @@ sub clean_up_tmpfiles
sub clean_up_incoming_queue
{
my ($curproc) = @_;
+ my $config = $curproc->config();
+ my $channel = 'mail_incoming_queue_clean_up';
# Mail::Delivery::Queue object.
my $queue = $curproc->mail_queue_get_incoming_queue() || undef;
if (defined $queue) {
$queue->remove();
}
+
+ # remove too old incoming queue files.
+ if ($curproc->is_event_timeout($channel)) {
+ my $fp = sub { $curproc->log(@_);};
+
+ use Mail::Delivery::Queue;
+ my $queue_dir = $config->{ mail_queue_dir };
+ my $queue = new Mail::Delivery::Queue { directory => $queue_dir };
+ $queue->set_log_function($fp);
+ $queue->clean_up();
+ $curproc->set_event_timeout($channel, time + 24*3600);
+ }
}