Commit 39802683 authored by david.verdin's avatar david.verdin
Browse files

[#3388] Change: If archived.pl can't create the list archive directory when...

[#3388] Change: If archived.pl can't create the list archive directory when archiving the first message, a notification is set to the listmaster, and the message is saved to spool/outgoing/bad.



git-svn-id: https://subversion.renater.fr/sympa/trunk@4738 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent db3f8668
......@@ -100,6 +100,12 @@ Subject: [% FILTER qencode %][%|loc%]Antivirus scan failed[%END%][%END%]
[% error_msg %]
[% ELSIF type == 'unable_to_create_dir' -%]
Subject: [% FILTER qencode %][%|loc%]Unable to create directory[%END%][%END%]
[%|loc(dir)%]Sympa could not create directory %1[%END%]
[%|loc%]See logs for more details.[%END%]
[% ELSIF type == 'edit_list_error' -%]
Subject: [% FILTER qencode %][%|loc%]incorrect format of edit_list.conf[%END%][%END%]
......
......@@ -201,6 +201,7 @@ while (!$end) {
foreach my $file (@files) {
last if $end;
next unless (-f "$queue/$file");
if ($file =~ /^\.remove\.((.*)\.(\d\d\d\d\-\d\d))\.\d+$/ ) {
my $arclistdir = $1;
......@@ -338,7 +339,8 @@ while (!$end) {
}
do_log('notice',"Archiving $file for list $adrlist");
mail2arc ($file, $listname, $hostname, $yyyy, $mm, $dd, $hh, $min, $ss) ;
mail2arc ($file, $listname, $hostname, $yyyy, $mm, $dd, $hh, $min, $ss);
if (-f "$queue/$file") {
unless (unlink("$queue/$file")) {
do_log ('err',"Ignoring file $queue/$file because couldn't remove it, archived.pl must use the same uid as sympa");
do_log ('err',"exiting because I don't want to loop until file system is full");
......@@ -346,6 +348,7 @@ while (!$end) {
}
}
}
}
}
do_log('notice', 'archived exited normally due to signal');
&tools::remove_pid($wwsconf->{'archived_pidfile'}, $$);
......@@ -750,6 +753,24 @@ sub mail2arc {
if (! -d $basedir) {
unless (mkdir $basedir, 0775) {
&do_log('err', 'Cannot create directory %s', $basedir);
unless (&List::send_notify_to_listmaster('unable_to_create_dir',$hostname,{'dir' => "$basedir"})) {
&do_log('notice',"Unable to send notify 'unable_to_create_dir' to listmaster");
}
my $queue = $Conf{'queueoutgoing'};
if (! -d $queue.'/bad') {
unless (mkdir $queue.'/bad', 0775) {
&do_log('notice','Unable to create %s/bad/ directory.',$queue);
unless (&List::send_notify_to_listmaster('unable_to_create_dir',$hostname),{'dir' => "$queue/bad"}) {
&do_log('notice',"Unable to send notify 'unable_to_create_dir' to listmaster");
}
return undef;
}
do_log('debug',"mkdir $queue/bad");
}
&do_log('notice',"Saving file %s to %s", $queue.'/'.$file, $queue.'/bad/'.$file);
unless (rename($queue.'/'.$file ,$queue.'/bad/'.$file) ) {
&do_log('notice', 'Could not rename %s to %s: %s', $queue.'/'.$file, $queue.'/bad/'.$file, $!);
}
return undef;
}
do_log('debug',"mkdir $basedir");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment