[Web] Restart SOGo after adding a new domain, fixes #864

This commit is contained in:
andre.peters
2018-01-11 22:40:43 +01:00
parent 0d8c7e446a
commit 278f1c2a37
6 changed files with 37 additions and 6 deletions

View File

@@ -333,6 +333,7 @@ function mailbox($_action, $_type, $_data = null, $attr = null) {
$aliases = $_data['aliases'];
$mailboxes = $_data['mailboxes'];
$maxquota = $_data['maxquota'];
$restart_sogo = $_data['restart_sogo'];
$quota = $_data['quota'];
if ($maxquota > $quota) {
$_SESSION['return'] = array(
@@ -416,10 +417,21 @@ function mailbox($_action, $_type, $_data = null, $attr = null) {
);
return false;
}
$_SESSION['return'] = array(
'type' => 'success',
'msg' => sprintf($lang['success']['domain_added'], htmlspecialchars($domain))
);
if (!empty($restart_sogo)) {
$restart_reponse = json_decode(docker('sogo-mailcow', 'post', 'restart'), true);
if ($restart_reponse['type'] == "success") {
$_SESSION['return'] = array(
'type' => 'success',
'msg' => sprintf($lang['success']['domain_added'], htmlspecialchars($domain))
);
}
else {
$_SESSION['return'] = array(
'type' => 'warning',
'msg' => 'Added domain but failed to restart SOGo, please check your server logs.'
);
}
}
}
catch (PDOException $e) {
mailbox('delete', 'domain', array('domain' => $domain));