Skip to content

Commit

Permalink
Upgrading process fills wwsympa_url parameters no longer mandatory.
Browse files Browse the repository at this point in the history
  • Loading branch information
ikedas committed Jun 6, 2018
1 parent 132c928 commit 97d893a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
3 changes: 0 additions & 3 deletions src/lib/Conf.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1971,9 +1971,6 @@ sub _infer_robot_parameter_values {
if not defined $param->{'config_hash'}{'domain'}
and defined $param->{'config_hash'}{'host'};

#XXX$param->{'config_hash'}{'wwsympa_url'} ||= sprintf 'http://%s/sympa',
#XXX $param->{'config_hash'}{'domain'};

$param->{'config_hash'}{'static_content_url'} ||=
$Conf{'static_content_url'};
$param->{'config_hash'}{'static_content_path'} ||=
Expand Down
28 changes: 28 additions & 0 deletions src/lib/Sympa/Upgrade.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1831,6 +1831,34 @@ sub upgrade {
}
}

# GH #330: wwsympa_url would be optional. http://domain/sympa is
# assigned to robot.conf for compatibility.
if (lower_version($previous_version, '6.2.33b.2')) {
my @robot_ids = Sympa::List::get_robots();
foreach my $robot_id (@robot_ids) {
next if $robot_id eq $Conf::Conf{'domain'}; # Primary domain

my $config_file =
sprintf '%s/%s/robot.conf', $Conf::Conf{'etc'}, $robot_id;

my $ifh;
next unless open $ifh, '<', $config_file;
my ($parameter) = grep {/\Awwsympa_url\s+\S+/} <$ifh>;
close $ifh;
next if $parameter;

$log->syslog('info', 'Updating wwsympa_url for %s', $robot_id);
my $ofh;
unless (open $ofh, '>>', $config_file) {
$log->syslog('err', 'Cannot write to %s: %m', $config_file);
next;
}
printf $ofh "\n\n# Added by upgrade from %s\n", $previous_version;
printf $ofh "wwsympa_url\thttp://%s/sympa\n", $robot_id;
close $ofh;
}
}

return 1;
}

Expand Down

0 comments on commit 97d893a

Please sign in to comment.