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

[-bug] Upgrade anomaly: Both authkey and html view for moderated messages were...

[-bug] Upgrade anomaly: Both authkey and html view for moderated messages were not migrated during upgrade, leading to empy messages in the HTML view and the impossibility to moderate messages.


git-svn-id: https://subversion.renater.fr/sympa/branches/sympa-6.2-branch@8858 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent fb47a1d6
...@@ -487,7 +487,7 @@ sub store { ...@@ -487,7 +487,7 @@ sub store {
$metadata->{'message_status'} = 'ok'; $metadata->{'message_status'} = 'ok';
my $insertpart1; my $insertpart2; my $insertpart1; my $insertpart2;
foreach my $meta ('list','robot','message_status','priority','date','type','subject','sender','messageid','size','headerdate','spam_status','dkim_privatekey','dkim_d','dkim_i','dkim_selector','create_list_if_needed','task_label','task_date','task_model','task_flavour','task_object') { foreach my $meta ('list','authkey','robot','message_status','priority','date','type','subject','sender','messageid','size','headerdate','spam_status','dkim_privatekey','dkim_d','dkim_i','dkim_selector','create_list_if_needed','task_label','task_date','task_model','task_flavour','task_object') {
$insertpart1 = $insertpart1. ', '.$meta.'_spool'; $insertpart1 = $insertpart1. ', '.$meta.'_spool';
$insertpart2 = $insertpart2. ', '.&SDM::quote($metadata->{$meta}); $insertpart2 = $insertpart2. ', '.&SDM::quote($metadata->{$meta});
} }
......
...@@ -28,6 +28,7 @@ use strict; ...@@ -28,6 +28,7 @@ use strict;
use POSIX qw(strftime); use POSIX qw(strftime);
# tentative # tentative
use Data::Dumper; use Data::Dumper;
use File::Copy::Recursive;
use Site; use Site;
#use Conf; # used in Site #use Conf; # used in Site
...@@ -952,12 +953,26 @@ sub upgrade { ...@@ -952,12 +953,26 @@ sub upgrade {
} }
$messageasstring .= "\n"; $messageasstring .= "\n";
} }
my $messagekey = $spool->store($messageasstring,\%meta); my $messagekey = $spool->store($messageasstring,\%meta);
unless($messagekey) { unless($messagekey) {
&Log::do_log('err',"Could not load message %s/%s in db spool",$spooldir, $filename); &Log::do_log('err',"Could not load message %s/%s in db spool",$spooldir, $filename);
next; next;
} }
if ($spoolparameter eq 'queuemod') {
my $html_view_dir = $spooldir.'/.'.$filename;
my $list_html_view_dir = Site->viewmail_dir.'/mod/'.$listname.'@'.$robot_id;
my $new_html_view_dir = $list_html_view_dir.'/'.$meta{'authkey'};
unless (tools::mkdir_all($list_html_view_dir, 0755)) {
&Log::do_log('err', 'Could not create list html view directory %s: %s', $list_html_view_dir, $!);
exit 1;
}
unless (File::Copy::Recursive::dircopy($html_view_dir, $new_html_view_dir)) {
&Log::do_log('err', 'Could not rename %s to %s: %s', $html_view_dir,$new_html_view_dir, $!);
exit 1;
}
}
mkdir $spooldir.'/copy_by_upgrade_process/' unless (-d $spooldir.'/copy_by_upgrade_process/'); mkdir $spooldir.'/copy_by_upgrade_process/' unless (-d $spooldir.'/copy_by_upgrade_process/');
my $source = $spooldir.'/'.$filename; my $source = $spooldir.'/'.$filename;
...@@ -967,7 +982,7 @@ sub upgrade { ...@@ -967,7 +982,7 @@ sub upgrade {
# unless (&File::Copy::copy($spooldir.'/'.$filename, $spooldir.'/copy_by_upgrade_process/'.$filename)) { # unless (&File::Copy::copy($spooldir.'/'.$filename, $spooldir.'/copy_by_upgrade_process/'.$filename)) {
unless (&File::Copy::copy($source, $goal)) { unless (&File::Copy::copy($source, $goal)) {
&Log::do_log('err', 'Could not rename %s to %s: %s', $source,$goal, $!); &Log::do_log('err', 'Could not rename %s to %s: %s', $source,$goal, $!);
exit; exit 1;
} }
unless (unlink ($spooldir.'/'.$filename)) { unless (unlink ($spooldir.'/'.$filename)) {
......
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