From 0e00fc9cdb2b7cce9f5c68ee80d4858164050e3a Mon Sep 17 00:00:00 2001 From: Guillaume Barbe Date: Wed, 27 Feb 2019 16:29:05 -0500 Subject: [PATCH] Delete wrapper on virtual mailman patch + cleanup code --- bureau/class/m_mailman.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bureau/class/m_mailman.php b/bureau/class/m_mailman.php index 8b413cd..06db298 100644 --- a/bureau/class/m_mailman.php +++ b/bureau/class/m_mailman.php @@ -426,13 +426,13 @@ function delete_lst($id) { return false; } - $db->query("UPDATE mailman SET mailman_action ='DELETE' WHERE id = ?", array( $id )); - $this->del_wrapper_all($login,$domain); #If login and list are different, it means we are dealing with a virtual list, hence we have to remove its aliases when deleting it. if("$login" != "$list"){ - $this->del_wrapper_all($list,$domain); + $this->del_wrapper_all($list, $domain); + } else { + $this->del_wrapper_all($login,$domain); } return $login."@".$domain; } @@ -444,12 +444,12 @@ function del_wrapper_all($login,$domain){ if (!($dom_id = $dom->get_domain_byname($domain))) { return false; } - - $this->del_wrapper($login,$dom_id); $this->del_wrapper($login."-request",$dom_id); - $this->del_wrapper($login."-owner",$dom_id); $this->del_wrapper($login."-admin",$dom_id); - $this->del_wrapper($login."-bounces",$dom_id); $this->del_wrapper($login."-confirm",$dom_id); - $this->del_wrapper($login."-join",$dom_id); $this->del_wrapper($login."-leave",$dom_id); - $this->del_wrapper($login."-subscribe",$dom_id); $this->del_wrapper($login."-unsubscribe",$dom_id); + $this->del_wrapper($login, $dom_id); + foreach ( ['request', 'owner', 'admin', 'bounces', 'confirm', + 'join', 'leave', 'subscribe', 'unsubscribe'] as + $wrapper) { + $this->del_wrapper($login . '-' . $wrapper, $dom_id); + } }