Commit 245428aa authored by IKEDA Soji's avatar IKEDA Soji
Browse files

[bug] task_manager.pl dies when the list no longer exist when some command...

[bug] task_manager.pl dies when the list no longer exist when some command such as sync_include was executed.
Fixed by checking if target list exists.
parent 7164bc79
...@@ -295,6 +295,11 @@ sub do_select_subs { ...@@ -295,6 +295,11 @@ sub do_select_subs {
my %selection; my %selection;
my $list = $task->{context}; my $list = $task->{context};
unless (ref $list eq 'Sympa::List') {
$log->syslog('err', 'No list');
return {};
}
for ( for (
my $user = $list->get_first_list_member(); my $user = $list->get_first_list_member();
$user; $user;
...@@ -325,6 +330,11 @@ sub do_delete_subs { ...@@ -325,6 +330,11 @@ sub do_delete_subs {
$log->syslog('notice', 'Line %s: delete_subs (%s)', $line->{line}, $var); $log->syslog('notice', 'Line %s: delete_subs (%s)', $line->{line}, $var);
my $list = $task->{context}; my $list = $task->{context};
unless (ref $list eq 'Sympa::List') {
$log->syslog('err', 'No list');
return {};
}
my %selection; # hash of subscriber emails who are successfully deleted my %selection; # hash of subscriber emails who are successfully deleted
foreach my $email (keys %{$Rvars->{$var}}) { foreach my $email (keys %{$Rvars->{$var}}) {
...@@ -753,6 +763,7 @@ sub do_purge_tables { ...@@ -753,6 +763,7 @@ sub do_purge_tables {
foreach my $list (@{$all_lists || []}) { foreach my $list (@{$all_lists || []}) {
my $tracking = Sympa::Tracking->new(context => $list); my $tracking = Sympa::Tracking->new(context => $list);
next unless $tracking;
$removed += $removed +=
$tracking->remove_message_by_period( $tracking->remove_message_by_period(
...@@ -1330,6 +1341,10 @@ sub do_sync_include { ...@@ -1330,6 +1341,10 @@ sub do_sync_include {
my $line = shift; my $line = shift;
my $list = $task->{context}; my $list = $task->{context};
unless (ref $list eq 'Sympa::List') {
$log->syslog('err', 'No list');
return -1;
}
$list->sync_include; $list->sync_include;
$list->sync_include_admin $list->sync_include_admin
......
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