Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sympa.pl: Add an option "--rebuildarc=list@domain" to rebuild archives #994

Merged
merged 1 commit into from
Sep 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion src/sbin/sympa.pl.in
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ use Sympa::Language;
use Sympa::List;
use Sympa::Log;
use Sympa::Mailer;
use Sympa::Message;
use Sympa::Spindle::ProcessDigest;
use Sympa::Spindle::ProcessRequest;
use Sympa::Spool::Archive;
use Sympa::Template;
use Sympa::Tools::Data;
use Sympa::Upgrade;
Expand Down Expand Up @@ -87,7 +89,7 @@ unless (
'upgrade_config_location', 'role=s',
'dump_users', 'restore_users',
'open_list=s', 'show_pending_lists=s',
'notify'
'notify', 'rebuildarc=s'
)
) {
pod2usage(-exitval => 1, -output => \*STDERR);
Expand Down Expand Up @@ -1069,6 +1071,30 @@ elsif ($main::options{'sync_list_db'}) {
$main::options{'show_pending_lists'};
}
exit 0;
} elsif ($main::options{'rebuildarc'}) {
my ($listname, $robot_id) = split /\@/, $main::options{'rebuildarc'}, 2;
my $current_list = Sympa::List->new($listname, $robot_id);
unless ($current_list) {
printf STDERR "Incorrect list name %s.\n",
$main::options{'rebuildarc'};
exit 1;
}

my $arc_message = Sympa::Message->new(
sprintf("\nrebuildarc %s *\n\n", $listname),
context => $robot_id,
sender => Sympa::get_address($robot_id, 'listmaster'),
date => time
);
my $marshalled = Sympa::Spool::Archive->new->store($arc_message);
unless ($marshalled) {
printf STDERR "Cannot store command to rebuild archive of list %s.\n",
$main::options{'rebuildarc'};
exit 1;
}
printf "Archive rebuild scheduled for %s.\n",
$main::options{'rebuildarc'};
exit 0
}

die 'Unknown option';
Expand Down Expand Up @@ -1760,6 +1786,7 @@ S<[ C<--lowercase> ]> S<[ C<--make_alias_file> ]>
S<[ C<--dump_users> C<--list>=I<list>@I<domain>|ALL [ C<--role>=I<roles> ] ]>
S<[ C<--restore_users> C<--list>=I<list>@I<domain>|ALL [ C<--role>=I<roles> ] ]>
S<[ C<--show_pending_lists>=I<robot> ]>
S<[ C<--rebuildarc>=I<list>[I<@robot>] ]>

=head1 DESCRIPTION

Expand Down Expand Up @@ -1930,6 +1957,10 @@ Remove the list (remove archive, configuration files, users and owners in admin

Print all pending lists for the robot, with informations.

=item C<--rebuildarc>=I<list>[I<@robot>]

Rebuild the archives of the list.

=item C<--reload_list_config>
[ C<--list=>I<mylist>@I<mydom> ] [ C<--robot=>I<mydom> ]

Expand Down