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%] ...@@ -100,6 +100,12 @@ Subject: [% FILTER qencode %][%|loc%]Antivirus scan failed[%END%][%END%]
[% error_msg %] [% 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' -%] [% ELSIF type == 'edit_list_error' -%]
Subject: [% FILTER qencode %][%|loc%]incorrect format of edit_list.conf[%END%][%END%] Subject: [% FILTER qencode %][%|loc%]incorrect format of edit_list.conf[%END%][%END%]
......
...@@ -201,6 +201,7 @@ while (!$end) { ...@@ -201,6 +201,7 @@ while (!$end) {
foreach my $file (@files) { foreach my $file (@files) {
last if $end; last if $end;
next unless (-f "$queue/$file");
if ($file =~ /^\.remove\.((.*)\.(\d\d\d\d\-\d\d))\.\d+$/ ) { if ($file =~ /^\.remove\.((.*)\.(\d\d\d\d\-\d\d))\.\d+$/ ) {
my $arclistdir = $1; my $arclistdir = $1;
...@@ -337,12 +338,14 @@ while (!$end) { ...@@ -337,12 +338,14 @@ while (!$end) {
return undef; return undef;
} }
do_log('notice',"Archiving $file for list $adrlist"); 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);
unless (unlink("$queue/$file")) { if (-f "$queue/$file") {
do_log ('err',"Ignoring file $queue/$file because couldn't remove it, archived.pl must use the same uid as sympa"); unless (unlink("$queue/$file")) {
do_log ('err',"exiting because I don't want to loop until file system is full"); do_log ('err',"Ignoring file $queue/$file because couldn't remove it, archived.pl must use the same uid as sympa");
last; do_log ('err',"exiting because I don't want to loop until file system is full");
last;
}
} }
} }
} }
...@@ -750,6 +753,24 @@ sub mail2arc { ...@@ -750,6 +753,24 @@ sub mail2arc {
if (! -d $basedir) { if (! -d $basedir) {
unless (mkdir $basedir, 0775) { unless (mkdir $basedir, 0775) {
&do_log('err', 'Cannot create directory %s', $basedir); &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; return undef;
} }
do_log('debug',"mkdir $basedir"); 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