Unverified Commit 472a09ba authored by IKEDA Soji's avatar IKEDA Soji Committed by GitHub
Browse files

Merge pull request #1084 from ikedas/make_alias_template by ikedas

Fix and speed up make_alias_file Sympa command (#1046)
parents 13af5d06 de50a625
......@@ -211,6 +211,11 @@ Use a subclass C<Sympa::Aliases::I<name>> to manage aliases.
For invalid types returns C<undef>.
For compatibility to the earlier versions of Sympa,
if a string C<SBINDIR/alias_manager.pl> was given as $type,
L<Sympa::Aliases::Template> subclass will be used.
Optional C<I<key> =E<gt> I<value>> pairs are included in the instance as
hash entries.
......@@ -40,6 +40,7 @@ use Pod::Usage;
use POSIX qw();
use Sympa;
use Sympa::Aliases;
use Conf;
use Sympa::Constants;
use Sympa::DatabaseManager;
......@@ -435,6 +436,8 @@ if ($main::options{'dump'} or $main::options{'dump_users'}) {
foreach my $robot (@robots) {
my $file = Conf::get_robot_conf($robot, 'sendmail_aliases');
next if $file eq 'none';
$robots_of{$file} ||= [];
push @{$robots_of{$file}}, $robot;
......@@ -460,10 +463,14 @@ if ($main::options{'dump'} or $main::options{'dump_users'}) {
# Write files.
foreach my $robot (sort @robots) {
my $all_lists = Sympa::List::get_lists($robot);
my $alias_manager = Conf::get_robot_conf($robot, 'alias_manager');
my $sympa_aliases = $sympa_aliases{$robot};
my $aliases =
Sympa::Aliases->new($alias_manager, file => $sympa_aliases);
unless $aliases and $aliases->isa('Sympa::Aliases::Template');
my $fh;
unless (open $fh, '>>', $sympa_aliases) { # append
printf STDERR "Unable to create %s: %s\n", $sympa_aliases, $ERRNO;
......@@ -472,11 +479,12 @@ if ($main::options{'dump'} or $main::options{'dump_users'}) {
printf $fh "#\n#\tAliases for all Sympa lists open on %s\n#\n",
close $fh;
my $all_lists = Sympa::List::get_lists($robot);
foreach my $list (@{$all_lists || []}) {
next unless $list->{'admin'}{'status'} eq 'open';
system($alias_manager, 'add', $list->{'name'}, $list->{'domain'},
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