Unverified Commit 2d62abf3 authored by IKEDA Soji's avatar IKEDA Soji Committed by GitHub
Browse files

Merge pull request #1189 from ikedas/delete_list_member_picture by Jylhis & ikedas

delete_list_member() failed removing subscribers' pictures
parents dfaec7e3 a0930a20
...@@ -1532,6 +1532,7 @@ sub send_probe_to_user { ...@@ -1532,6 +1532,7 @@ sub send_probe_to_user {
## $list->delete_list_member('users' => \@u, 'exclude' => 1) ## $list->delete_list_member('users' => \@u, 'exclude' => 1)
## $list->delete_list_member('users' => [$email], 'exclude' => 1) ## $list->delete_list_member('users' => [$email], 'exclude' => 1)
sub delete_list_member { sub delete_list_member {
$log->syslog('debug2', '(%s, ...)', @_);
my $self = shift; my $self = shift;
my %param = @_; my %param = @_;
my @u = @{$param{'users'}}; my @u = @{$param{'users'}};
...@@ -1543,12 +1544,12 @@ sub delete_list_member { ...@@ -1543,12 +1544,12 @@ sub delete_list_member {
$log->syslog('debug2', ''); $log->syslog('debug2', '');
my $name = $self->{'name'};
my $total = 0; my $total = 0;
my $sdm = Sympa::DatabaseManager->instance; my $sdm = Sympa::DatabaseManager->instance;
foreach my $who (@u) { foreach my $who (@u) {
next unless defined $who and length $who;
$who = Sympa::Tools::Text::canonic_email($who); $who = Sympa::Tools::Text::canonic_email($who);
## Include in exclusion_table only if option is set. ## Include in exclusion_table only if option is set.
...@@ -1564,13 +1565,16 @@ sub delete_list_member { ...@@ -1564,13 +1565,16 @@ sub delete_list_member {
q{DELETE FROM subscriber_table q{DELETE FROM subscriber_table
WHERE user_subscriber = ? AND WHERE user_subscriber = ? AND
list_subscriber = ? AND robot_subscriber = ?}, list_subscriber = ? AND robot_subscriber = ?},
$who, $name, $self->{'domain'} $who, $self->{'name'}, $self->{'domain'}
) )
) { ) {
$log->syslog('err', 'Unable to remove list member %s', $who); $log->syslog('err', 'Unable to remove list member %s', $who);
next; next;
} }
# Delete the pictures if any.
$self->delete_list_member_picture($who);
# Delete signoff requests if any. # Delete signoff requests if any.
my $spool_req = Sympa::Spool::Auth->new( my $spool_req = Sympa::Spool::Auth->new(
context => $self, context => $self,
...@@ -1589,7 +1593,7 @@ sub delete_list_member { ...@@ -1589,7 +1593,7 @@ sub delete_list_member {
if ($operation) { if ($operation) {
$log->add_stat( $log->add_stat(
'robot' => $self->{'domain'}, 'robot' => $self->{'domain'},
'list' => $name, 'list' => $self->{'name'},
'operation' => $operation, 'operation' => $operation,
'mail' => $who 'mail' => $who
); );
...@@ -1599,22 +1603,22 @@ sub delete_list_member { ...@@ -1599,22 +1603,22 @@ sub delete_list_member {
} }
$self->_cache_publish_expiry('member'); $self->_cache_publish_expiry('member');
delete_list_member_picture($self, shift(@u));
return (-1 * $total); return (-1 * $total);
} }
## Delete the indicated admin users from the list. ## Delete the indicated admin users from the list.
sub delete_list_admin { sub delete_list_admin {
my ($self, $role, @u) = @_; $log->syslog('debug2', '(%s, %s, ...)', @_);
$log->syslog('debug2', '', $role); my $self = shift;
my $role = shift;
my @u = @_;
my $name = $self->{'name'};
my $total = 0; my $total = 0;
foreach my $who (@u) { foreach my $who (@u) {
next unless defined $who and length $who;
$who = Sympa::Tools::Text::canonic_email($who); $who = Sympa::Tools::Text::canonic_email($who);
my $statement;
my $sdm = Sympa::DatabaseManager->instance; my $sdm = Sympa::DatabaseManager->instance;
...@@ -3295,7 +3299,7 @@ sub add_list_member { ...@@ -3295,7 +3299,7 @@ sub add_list_member {
} }
} }
#Log in stat_table to make staistics #Log in stat_table to make statistics
$log->add_stat( $log->add_stat(
'robot' => $self->{'domain'}, 'robot' => $self->{'domain'},
'list' => $self->{'name'}, 'list' => $self->{'name'},
......
Markdown is supported
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