Commit a8123880 authored by Florian Schaal's avatar Florian Schaal

Allow the admin to configure the deleting of backups when a web-site / mail-domain is deleted.

parent f858c22b
......@@ -19,6 +19,7 @@ backup_dir=/var/backup
backup_dir_is_mount=n
backup_dir_mount_cmd=
backup_mode=rootgz
baclup_delete=n
monit_url=
monit_user=
monit_password=
......
......@@ -195,6 +195,12 @@ $form["tabs"]['server'] = array(
'width' => '40',
'maxlength' => '255'
),
'backup_delete' => array(
'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
'default' => 'y',
'value' => array(0 => 'n', 1 => 'y')
),
'monit_url' => array(
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
......
......@@ -196,4 +196,5 @@ $wb["vhost_rewrite_v6_txt"] = 'Rewrite IPv6 on Mirror';
$wb["v6_prefix_length"] = 'Prefix too long according to defined IPv6 ';
$wb['backup_dir_is_mount_txt'] = 'Backup directory is a mount?';
$wb['backup_dir_mount_cmd_txt'] = 'Mount command, if backup directory not mounted';
$wb['backup_delete_txt'] = 'Delete backups on domain/website delete';
?>
......@@ -73,6 +73,12 @@
<select name="backup_mode" id="backup_mode" class="selectInput">
{tmpl_var name='backup_mode'}
</select>
</div>
<div class="ctrlHolder">
<p class="label">{tmpl_var name='backup_delete_txt'}</p>
<div class="multiField">
{tmpl_var name='backup_delete'}
</div>
</div>
<div class="ctrlHolder">
<label for="monit_url">{tmpl_var name='monit_url_txt'}</label>
......
......@@ -1991,7 +1991,7 @@ class apache2_plugin {
//* mount backup directory, if necessary
$mount_backup = true;
$server_config['backup_dir_mount_cmd'] = trim($server_config['backup_dir_mount_cmd']);
if($server_config['backup_dir'] != '') {
if($server_config['backup_dir'] != '' && $server_config['backup_delete'] == 'y') {
if($server_config['backup_dir_is_mount'] == 'y' && $server_config['backup_dir_mount_cmd'] != ''){
if(!$app->system->is_mounted($backup_dir)){
exec(escapeshellcmd($server_config['backup_dir_mount_cmd']));
......
......@@ -326,13 +326,14 @@ class mail_plugin {
} else {
$app->log('Possible security violation when deleting the maildir: '.$data['old']['maildir'], LOGLEVEL_ERROR);
}
//* Delete the mail-backups
$server_config = $app->getconf->get_server_config($conf['server_id'], 'server');
$backup_dir = $server_config['backup_dir'];
//* mount backup directory, if necessary
$mount_backup = true;
$server_config['backup_dir_mount_cmd'] = trim($server_config['backup_dir_mount_cmd']);
if($server_config['backup_dir'] != '' && $maildir_path_deleted) {
if($server_config['backup_dir'] != '' && $maildir_path_deleted && $server_config['backup_delete'] == 'y') {
if($server_config['backup_dir_is_mount'] == 'y' && $server_config['backup_dir_mount_cmd'] != ''){
if(!$app->system->is_mounted($backup_dir)){
exec(escapeshellcmd($server_config['backup_dir_mount_cmd']));
......@@ -391,7 +392,7 @@ class mail_plugin {
//* mount backup directory, if necessary
$mount_backup = true;
$server_config['backup_dir_mount_cmd'] = trim($server_config['backup_dir_mount_cmd']);
if($server_config['backup_dir'] != '' && $maildomain_path_deleted) {
if($server_config['backup_dir'] != '' && $maildomain_path_deleted && $server_config['backup_delete'] == 'y'){
if($server_config['backup_dir_is_mount'] == 'y' && $server_config['backup_dir_mount_cmd'] != ''){
if(!$app->system->is_mounted($backup_dir)){
exec(escapeshellcmd($server_config['backup_dir_mount_cmd']));
......
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