| | |
| | | //$app->plugins->registerEvent('mail_domain_update',$this->plugin_name,'domain_update'); |
| | | $app->plugins->registerEvent('mail_domain_delete',$this->plugin_name,'domain_delete'); |
| | | |
| | | //* Mail transports |
| | | $app->plugins->registerEvent('mail_transport_insert',$this->plugin_name,'transport_update'); |
| | | $app->plugins->registerEvent('mail_transport_update',$this->plugin_name,'transport_update'); |
| | | $app->plugins->registerEvent('mail_transport_delete',$this->plugin_name,'transport_update'); |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | //* This is to fix the maildrop quota not being rebuilt after the quota is changed. |
| | | exec("su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']); // Avoid maildirmake quota bug, see debian bug #214911 |
| | | $app->log('Created Maildir: '."su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG); |
| | | } |
| | | } |
| | | |
| | | //* Set the maildir quota |
| | | exec("su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($data['new']['maildir'])."' ".$mail_config['mailuser_name']); |
| | | $app->log('Set Maildir quota: '."su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($data['new']['maildir'])."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG); |
| | | } |
| | | |
| | | function user_update($event_name,$data) { |
| | |
| | | // Move mailbox, if domain has changed and delete old mailbox |
| | | if($data['new']['maildir'] != $data['old']['maildir'] && is_dir($data['old']['maildir'])) { |
| | | if(is_dir($data['new']['maildir'])) { |
| | | exec("rm -f ".escapeshellcmd($data['new']['maildir']).'/*'); |
| | | rmdir($data['new']['maildir']); |
| | | exec("rm -fr ".escapeshellcmd($data['new']['maildir'])); |
| | | //rmdir($data['new']['maildir']); |
| | | } |
| | | exec('mv -f '.escapeshellcmd($data['old']['maildir']).' '.escapeshellcmd($data['new']['maildir'])); |
| | | // exec('mv -f '.escapeshellcmd($data['old']['maildir']).'/* '.escapeshellcmd($data['new']['maildir'])); |
| | |
| | | } |
| | | } |
| | | |
| | | function transport_update($event_name,$data) { |
| | | global $app, $conf; |
| | | |
| | | exec('/etc/init.d/postfix reload &> /dev/null'); |
| | | $app->log('Postfix config reloaded ',LOGLEVEL_DEBUG); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |