Skip to content

Commit 65b91c6

Browse files
author
Michele
committed
Implemented ML deletion
1 parent 3e5045a commit 65b91c6

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

server/plugins-available/mlmmj_plugin.inc.php

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,15 +225,32 @@ function delete($event_name, $data) {
225225
$mlManager = $app->getconf->get_server_config($conf['server_id'], 'mail')['mailinglist_manager'];
226226

227227
if($mlManager == 'mlmmj') {
228-
$a=0;
228+
$mlConf = $this->getMlConfig();
229+
$rec = $data['old'];
230+
$listDomain = $rec['domain'];
231+
$listName = $rec['listname'];
232+
$listDir = $mlConf['spool_dir']."/$listDomain/$listName";
233+
234+
// Remove ML directory structure
235+
$this->rmdirR($listDir);
236+
@rmdir($mlConf['spool_dir']."/$listDomain");
237+
238+
// Removing alias entry
239+
$this->delMapEntry("$listName: \"|/usr/bin/mlmmj-recieve -L $listDir/\"", self::ML_ALIAS);
240+
241+
// Removing transport entry
242+
$this->delMapEntry("$listDomain--$listName@localhost.mlmmj mlmmj:$listDomain/$listName", self::ML_TRANSPORT);
243+
244+
// Removing virtual entry
245+
$this->delMapEntry("$listName@$listDomain $listDomain--$listName@localhost.mlmmj", self::ML_VIRTUAL);
229246
}
230247
}
231248

232249
private function getMlConfig() {
233250
$mlConfig = @parse_ini_file($this->mlmmj_config_dir.'mlmmj.conf');
234251

235252
// Force PHP7 to use # to mark comments
236-
if(PHP_MAJOR_VERSION >= 7)
253+
if(PHP_MAJOR_VERSION >= 7 && is_array($mlConfig))
237254
$mlConfig = array_filter($mlConfig, function($v){return(substr($v,0,1)!=='#');}, ARRAY_FILTER_USE_KEY);
238255

239256
return $mlConfig;

0 commit comments

Comments
 (0)