From 634132a0d83a3c83a3927e2aa943c035030d6b80 Mon Sep 17 00:00:00 2001
From: Dominik <info@profi-webdesign.com>
Date: Thu, 19 Nov 2015 21:50:36 +0100
Subject: [PATCH] Added possibility to delete backups

Conflicts:
	interface/lib/classes/remoting.inc.php
	interface/web/mail/templates/mail_user_backup_list.htm
	interface/web/sites/lib/lang/en_web_backup_list.lng
	interface/web/sites/lib/lang/es_web_backup_list.lng
	interface/web/sites/lib/lang/tr_web_backup_list.lng
	server/plugins-available/backup_plugin.inc.php
---
 .../lib/classes/plugin_backuplist.inc.php     |  22 +++
 .../classes/plugin_backuplist_mail.inc.php    |  20 +++
 interface/lib/classes/remote.d/mail.inc.php   |   2 +-
 interface/lib/classes/remote.d/sites.inc.php  |   2 +-
 .../web/mail/lib/lang/ar_mail_backup_list.lng |   4 +
 .../web/mail/lib/lang/bg_mail_backup_list.lng |   4 +
 .../web/mail/lib/lang/br_mail_backup_list.lng |   4 +
 .../web/mail/lib/lang/cz_mail_backup_list.lng |   4 +
 .../web/mail/lib/lang/de_mail_backup_list.lng |   4 +
 .../web/mail/lib/lang/el_mail_backup_list.lng |   4 +
 .../web/mail/lib/lang/en_mail_backup_list.lng |   4 +
 .../web/mail/lib/lang/es_mail_backup_list.lng |   4 +
 .../web/mail/lib/lang/fi_mail_backup_list.lng |   4 +
 .../web/mail/lib/lang/fr_mail_backup_list.lng |   4 +
 .../web/mail/lib/lang/hr_mail_backup_list.lng |   4 +
 .../web/mail/lib/lang/hu_mail_backup_list.lng |   4 +
 .../web/mail/lib/lang/id_mail_backup_list.lng |   4 +
 .../web/mail/lib/lang/it_mail_backup_list.lng |   4 +
 .../web/mail/lib/lang/ja_mail_backup_list.lng |   4 +
 .../web/mail/lib/lang/nl_mail_backup_list.lng |   4 +
 .../web/mail/lib/lang/ru_mail_backup_list.lng |   4 +
 .../web/mail/lib/lang/se_mail_backup_list.lng |   4 +
 .../web/mail/lib/lang/sk_mail_backup_list.lng |   4 +
 .../web/mail/lib/lang/tr_mail_backup_list.lng |   4 +
 .../mail/templates/mail_user_backup_list.htm  |   3 +-
 .../web/sites/lib/lang/ar_web_backup_list.lng |   4 +
 .../web/sites/lib/lang/bg_web_backup_list.lng |   4 +
 .../web/sites/lib/lang/br_web_backup_list.lng |   4 +
 .../web/sites/lib/lang/cz_web_backup_list.lng |   4 +
 .../web/sites/lib/lang/de_web_backup_list.lng |   4 +
 .../web/sites/lib/lang/el_web_backup_list.lng |   4 +
 .../web/sites/lib/lang/en_web_backup_list.lng |   4 +
 .../web/sites/lib/lang/es_web_backup_list.lng |   5 +
 .../web/sites/lib/lang/fi_web_backup_list.lng |   4 +
 .../web/sites/lib/lang/fr_web_backup_list.lng |   4 +
 .../web/sites/lib/lang/hr_web_backup_list.lng |   4 +
 .../web/sites/lib/lang/hu_web_backup_list.lng |   4 +
 .../web/sites/lib/lang/id_web_backup_list.lng |   4 +
 .../web/sites/lib/lang/it_web_backup_list.lng |   4 +
 .../web/sites/lib/lang/ja_web_backup_list.lng |   4 +
 .../web/sites/lib/lang/nl_web_backup_list.lng |   4 +
 .../web/sites/lib/lang/pl_web_backup_list.lng |   4 +
 .../web/sites/lib/lang/pt_web_backup_list.lng |   4 +
 .../web/sites/lib/lang/ro_web_backup_list.lng |   4 +
 .../web/sites/lib/lang/ru_web_backup_list.lng |   4 +
 .../web/sites/lib/lang/se_web_backup_list.lng |   4 +
 .../web/sites/lib/lang/sk_web_backup_list.lng |   4 +
 .../web/sites/lib/lang/tr_web_backup_list.lng |   6 +-
 .../web/sites/templates/web_backup_list.htm   |   1 +
 .../classes/cron.d/500-backup_mail.inc.php    |  14 ++
 .../plugins-available/backup_plugin.inc.php   | 131 ++++++++++--------
 51 files changed, 312 insertions(+), 58 deletions(-)

diff --git a/interface/lib/classes/plugin_backuplist.inc.php b/interface/lib/classes/plugin_backuplist.inc.php
index 471560ab5e..205b2ef1f1 100644
--- a/interface/lib/classes/plugin_backuplist.inc.php
+++ b/interface/lib/classes/plugin_backuplist.inc.php
@@ -96,6 +96,28 @@ class plugin_backuplist extends plugin_base {
 					$error .= $wb['restore_pending_txt'];
 				}
 			}
+			if($_GET['backup_action'] == 'delete' && $backup_id > 0) {
+				$server_id = $this->form->dataRecord['server_id'];
+				$backup = $app->db->queryOneRecord("SELECT * FROM web_backup WHERE backup_id = ".$backup_id);
+				if($backup['server_id'] > 0) $server_id = $backup['server_id'];
+				$sql = "SELECT count(action_id) as number FROM sys_remoteaction WHERE action_state = 'pending' AND action_type = 'backup_delete' AND action_param = '$backup_id'";
+				$tmp = $app->db->queryOneRecord($sql);
+				if($tmp['number'] == 0) {
+					$message .= $wb['delete_info_txt'];
+					$sql =  "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
+						"VALUES (".
+						(int)$server_id . ", " .
+						time() . ", " .
+						"'backup_delete', " .
+						"'".$backup_id."', " .
+						"'pending', " .
+						"''" .
+						")";
+					$app->db->query($sql);
+				} else {
+					$error .= $wb['delete_pending_txt'];
+				}
+			}
 
 		}
 
diff --git a/interface/lib/classes/plugin_backuplist_mail.inc.php b/interface/lib/classes/plugin_backuplist_mail.inc.php
index 901901a3ed..91e7ee1fba 100644
--- a/interface/lib/classes/plugin_backuplist_mail.inc.php
+++ b/interface/lib/classes/plugin_backuplist_mail.inc.php
@@ -67,6 +67,26 @@ class plugin_backuplist_mail extends plugin_base {
 				} else {
 					$error .= $wb['restore_pending_txt'];
 				}
+			}	
+			
+			if($_GET['backup_action'] == 'delete_mail' && $backup_id > 0) {
+				$sql = "SELECT count(action_id) as number FROM sys_remoteaction WHERE action_state = 'pending' AND action_type = 'backup_delete_mail' AND action_param = '$backup_id'";
+				$tmp = $app->db->queryOneRecord($sql);
+				if($tmp['number'] == 0) {
+					$message .= $wb['delete_info_txt'];
+					$sql = 	"INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
+					"VALUES (".
+						(int)$this->form->dataRecord['server_id'] . ", " .
+						time() . ", " .
+						"'backup_delete_mail', " .
+						"'".$backup_id."', " .
+						"'pending', " .
+						"''" .
+					")";
+					$app->db->query($sql);
+				} else {
+					$error .= $wb['delete_pending_txt'];
+				}
 			}				
 		}
 				
diff --git a/interface/lib/classes/remote.d/mail.inc.php b/interface/lib/classes/remote.d/mail.inc.php
index 914777070b..9229899e57 100644
--- a/interface/lib/classes/remote.d/mail.inc.php
+++ b/interface/lib/classes/remote.d/mail.inc.php
@@ -357,7 +357,7 @@ class remoting_mail extends remoting {
 			return false;
 		}
 	
-		if (/*$action_type != 'backup_download_mail' and*/ $action_type != 'backup_restore_mail') {
+		if (/*$action_type != 'backup_download_mail' and*/ $action_type != 'backup_restore_mail' and $action_type != 'backup_delete_mail') {
 			$this->server->fault('invalid_action', "Invalid action_type $action_type");
 			return false;
 		}
diff --git a/interface/lib/classes/remote.d/sites.inc.php b/interface/lib/classes/remote.d/sites.inc.php
index ad3f2e3046..8770522647 100644
--- a/interface/lib/classes/remote.d/sites.inc.php
+++ b/interface/lib/classes/remote.d/sites.inc.php
@@ -931,7 +931,7 @@ class remoting_sites extends remoting {
 			return false;
 		}
 	
-		if ($action_type != 'backup_download' and $action_type != 'backup_restore') {
+		if ($action_type != 'backup_download' and $action_type != 'backup_restore' and $action_type != 'backup_delete') {
 			$this->server->fault('invalid_action', "Invalid action_type $action_type");
 			return false;
 		}
diff --git a/interface/web/mail/lib/lang/ar_mail_backup_list.lng b/interface/web/mail/lib/lang/ar_mail_backup_list.lng
index 320ff5023c..73286a0737 100644
--- a/interface/web/mail/lib/lang/ar_mail_backup_list.lng
+++ b/interface/web/mail/lib/lang/ar_mail_backup_list.lng
@@ -8,5 +8,9 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring may overwrite existing files in your mailbox. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['filesize_txt'] = 'Filesize';
 ?>
diff --git a/interface/web/mail/lib/lang/bg_mail_backup_list.lng b/interface/web/mail/lib/lang/bg_mail_backup_list.lng
index 320ff5023c..73286a0737 100644
--- a/interface/web/mail/lib/lang/bg_mail_backup_list.lng
+++ b/interface/web/mail/lib/lang/bg_mail_backup_list.lng
@@ -8,5 +8,9 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring may overwrite existing files in your mailbox. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['filesize_txt'] = 'Filesize';
 ?>
diff --git a/interface/web/mail/lib/lang/br_mail_backup_list.lng b/interface/web/mail/lib/lang/br_mail_backup_list.lng
index 320ff5023c..73286a0737 100644
--- a/interface/web/mail/lib/lang/br_mail_backup_list.lng
+++ b/interface/web/mail/lib/lang/br_mail_backup_list.lng
@@ -8,5 +8,9 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring may overwrite existing files in your mailbox. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['filesize_txt'] = 'Filesize';
 ?>
diff --git a/interface/web/mail/lib/lang/cz_mail_backup_list.lng b/interface/web/mail/lib/lang/cz_mail_backup_list.lng
index 320ff5023c..73286a0737 100644
--- a/interface/web/mail/lib/lang/cz_mail_backup_list.lng
+++ b/interface/web/mail/lib/lang/cz_mail_backup_list.lng
@@ -8,5 +8,9 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring may overwrite existing files in your mailbox. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['filesize_txt'] = 'Filesize';
 ?>
diff --git a/interface/web/mail/lib/lang/de_mail_backup_list.lng b/interface/web/mail/lib/lang/de_mail_backup_list.lng
index 320ff5023c..73286a0737 100644
--- a/interface/web/mail/lib/lang/de_mail_backup_list.lng
+++ b/interface/web/mail/lib/lang/de_mail_backup_list.lng
@@ -8,5 +8,9 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring may overwrite existing files in your mailbox. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['filesize_txt'] = 'Filesize';
 ?>
diff --git a/interface/web/mail/lib/lang/el_mail_backup_list.lng b/interface/web/mail/lib/lang/el_mail_backup_list.lng
index 320ff5023c..73286a0737 100644
--- a/interface/web/mail/lib/lang/el_mail_backup_list.lng
+++ b/interface/web/mail/lib/lang/el_mail_backup_list.lng
@@ -8,5 +8,9 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring may overwrite existing files in your mailbox. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['filesize_txt'] = 'Filesize';
 ?>
diff --git a/interface/web/mail/lib/lang/en_mail_backup_list.lng b/interface/web/mail/lib/lang/en_mail_backup_list.lng
index 320ff5023c..73286a0737 100644
--- a/interface/web/mail/lib/lang/en_mail_backup_list.lng
+++ b/interface/web/mail/lib/lang/en_mail_backup_list.lng
@@ -8,5 +8,9 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring may overwrite existing files in your mailbox. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['filesize_txt'] = 'Filesize';
 ?>
diff --git a/interface/web/mail/lib/lang/es_mail_backup_list.lng b/interface/web/mail/lib/lang/es_mail_backup_list.lng
index 320ff5023c..73286a0737 100644
--- a/interface/web/mail/lib/lang/es_mail_backup_list.lng
+++ b/interface/web/mail/lib/lang/es_mail_backup_list.lng
@@ -8,5 +8,9 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring may overwrite existing files in your mailbox. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['filesize_txt'] = 'Filesize';
 ?>
diff --git a/interface/web/mail/lib/lang/fi_mail_backup_list.lng b/interface/web/mail/lib/lang/fi_mail_backup_list.lng
index 320ff5023c..73286a0737 100644
--- a/interface/web/mail/lib/lang/fi_mail_backup_list.lng
+++ b/interface/web/mail/lib/lang/fi_mail_backup_list.lng
@@ -8,5 +8,9 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring may overwrite existing files in your mailbox. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['filesize_txt'] = 'Filesize';
 ?>
diff --git a/interface/web/mail/lib/lang/fr_mail_backup_list.lng b/interface/web/mail/lib/lang/fr_mail_backup_list.lng
index 320ff5023c..73286a0737 100644
--- a/interface/web/mail/lib/lang/fr_mail_backup_list.lng
+++ b/interface/web/mail/lib/lang/fr_mail_backup_list.lng
@@ -8,5 +8,9 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring may overwrite existing files in your mailbox. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['filesize_txt'] = 'Filesize';
 ?>
diff --git a/interface/web/mail/lib/lang/hr_mail_backup_list.lng b/interface/web/mail/lib/lang/hr_mail_backup_list.lng
index 320ff5023c..73286a0737 100644
--- a/interface/web/mail/lib/lang/hr_mail_backup_list.lng
+++ b/interface/web/mail/lib/lang/hr_mail_backup_list.lng
@@ -8,5 +8,9 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring may overwrite existing files in your mailbox. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['filesize_txt'] = 'Filesize';
 ?>
diff --git a/interface/web/mail/lib/lang/hu_mail_backup_list.lng b/interface/web/mail/lib/lang/hu_mail_backup_list.lng
index 320ff5023c..73286a0737 100644
--- a/interface/web/mail/lib/lang/hu_mail_backup_list.lng
+++ b/interface/web/mail/lib/lang/hu_mail_backup_list.lng
@@ -8,5 +8,9 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring may overwrite existing files in your mailbox. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['filesize_txt'] = 'Filesize';
 ?>
diff --git a/interface/web/mail/lib/lang/id_mail_backup_list.lng b/interface/web/mail/lib/lang/id_mail_backup_list.lng
index 320ff5023c..73286a0737 100644
--- a/interface/web/mail/lib/lang/id_mail_backup_list.lng
+++ b/interface/web/mail/lib/lang/id_mail_backup_list.lng
@@ -8,5 +8,9 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring may overwrite existing files in your mailbox. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['filesize_txt'] = 'Filesize';
 ?>
diff --git a/interface/web/mail/lib/lang/it_mail_backup_list.lng b/interface/web/mail/lib/lang/it_mail_backup_list.lng
index 320ff5023c..73286a0737 100644
--- a/interface/web/mail/lib/lang/it_mail_backup_list.lng
+++ b/interface/web/mail/lib/lang/it_mail_backup_list.lng
@@ -8,5 +8,9 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring may overwrite existing files in your mailbox. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['filesize_txt'] = 'Filesize';
 ?>
diff --git a/interface/web/mail/lib/lang/ja_mail_backup_list.lng b/interface/web/mail/lib/lang/ja_mail_backup_list.lng
index 320ff5023c..73286a0737 100644
--- a/interface/web/mail/lib/lang/ja_mail_backup_list.lng
+++ b/interface/web/mail/lib/lang/ja_mail_backup_list.lng
@@ -8,5 +8,9 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring may overwrite existing files in your mailbox. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['filesize_txt'] = 'Filesize';
 ?>
diff --git a/interface/web/mail/lib/lang/nl_mail_backup_list.lng b/interface/web/mail/lib/lang/nl_mail_backup_list.lng
index 320ff5023c..73286a0737 100644
--- a/interface/web/mail/lib/lang/nl_mail_backup_list.lng
+++ b/interface/web/mail/lib/lang/nl_mail_backup_list.lng
@@ -8,5 +8,9 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring may overwrite existing files in your mailbox. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['filesize_txt'] = 'Filesize';
 ?>
diff --git a/interface/web/mail/lib/lang/ru_mail_backup_list.lng b/interface/web/mail/lib/lang/ru_mail_backup_list.lng
index 320ff5023c..73286a0737 100644
--- a/interface/web/mail/lib/lang/ru_mail_backup_list.lng
+++ b/interface/web/mail/lib/lang/ru_mail_backup_list.lng
@@ -8,5 +8,9 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring may overwrite existing files in your mailbox. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['filesize_txt'] = 'Filesize';
 ?>
diff --git a/interface/web/mail/lib/lang/se_mail_backup_list.lng b/interface/web/mail/lib/lang/se_mail_backup_list.lng
index 320ff5023c..73286a0737 100644
--- a/interface/web/mail/lib/lang/se_mail_backup_list.lng
+++ b/interface/web/mail/lib/lang/se_mail_backup_list.lng
@@ -8,5 +8,9 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring may overwrite existing files in your mailbox. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['filesize_txt'] = 'Filesize';
 ?>
diff --git a/interface/web/mail/lib/lang/sk_mail_backup_list.lng b/interface/web/mail/lib/lang/sk_mail_backup_list.lng
index 320ff5023c..73286a0737 100644
--- a/interface/web/mail/lib/lang/sk_mail_backup_list.lng
+++ b/interface/web/mail/lib/lang/sk_mail_backup_list.lng
@@ -8,5 +8,9 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring may overwrite existing files in your mailbox. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['filesize_txt'] = 'Filesize';
 ?>
diff --git a/interface/web/mail/lib/lang/tr_mail_backup_list.lng b/interface/web/mail/lib/lang/tr_mail_backup_list.lng
index 320ff5023c..73286a0737 100644
--- a/interface/web/mail/lib/lang/tr_mail_backup_list.lng
+++ b/interface/web/mail/lib/lang/tr_mail_backup_list.lng
@@ -8,5 +8,9 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring may overwrite existing files in your mailbox. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['filesize_txt'] = 'Filesize';
 ?>
diff --git a/interface/web/mail/templates/mail_user_backup_list.htm b/interface/web/mail/templates/mail_user_backup_list.htm
index b8f29a87bd..87dc2a548f 100644
--- a/interface/web/mail/templates/mail_user_backup_list.htm
+++ b/interface/web/mail/templates/mail_user_backup_list.htm
@@ -27,6 +27,7 @@
                             <td class="text-right">
                                 <div class="buttons">
                                     <button class="btn btn-default formbutton-default" type="button" onclick="ISPConfig.confirm_action('mail/mail_user_edit.php?id={tmpl_var name='parent_id'}&next_tab=backup&backup_action=restore_mail&backup_id={tmpl_var name='backup_id'}','{tmpl_var name='restore_confirm_txt'}');">{tmpl_var name="restore_backup_txt"}</button>
+                                    <button class="btn btn-default formbutton-default" type="button" onclick="ISPConfig.confirm_action('mail/mail_user_edit.php?id={tmpl_var name='parent_id'}&next_tab=backup&backup_action=delete_mail&backup_id={tmpl_var name='backup_id'}','{tmpl_var name='delete_confirm_txt'}');">{tmpl_var name="delete_backup_txt"}</button>
                                 </div>
                             </td>
                         </tr>
@@ -38,4 +39,4 @@
                     </tmpl_unless>
                 </tbody>
             </table>
-</div>
\ No newline at end of file
+</div>
diff --git a/interface/web/sites/lib/lang/ar_web_backup_list.lng b/interface/web/sites/lib/lang/ar_web_backup_list.lng
index 9a10ca6d07..fa4a59b403 100644
--- a/interface/web/sites/lib/lang/ar_web_backup_list.lng
+++ b/interface/web/sites/lib/lang/ar_web_backup_list.lng
@@ -10,6 +10,10 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring will overwrite existing files in your website. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['backup_type_mysql'] = 'MySQL Database';
 $wb['backup_type_web'] = 'Website files';
 ?>
diff --git a/interface/web/sites/lib/lang/bg_web_backup_list.lng b/interface/web/sites/lib/lang/bg_web_backup_list.lng
index 9a10ca6d07..fa4a59b403 100644
--- a/interface/web/sites/lib/lang/bg_web_backup_list.lng
+++ b/interface/web/sites/lib/lang/bg_web_backup_list.lng
@@ -10,6 +10,10 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring will overwrite existing files in your website. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['backup_type_mysql'] = 'MySQL Database';
 $wb['backup_type_web'] = 'Website files';
 ?>
diff --git a/interface/web/sites/lib/lang/br_web_backup_list.lng b/interface/web/sites/lib/lang/br_web_backup_list.lng
index 9a10ca6d07..fa4a59b403 100644
--- a/interface/web/sites/lib/lang/br_web_backup_list.lng
+++ b/interface/web/sites/lib/lang/br_web_backup_list.lng
@@ -10,6 +10,10 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring will overwrite existing files in your website. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['backup_type_mysql'] = 'MySQL Database';
 $wb['backup_type_web'] = 'Website files';
 ?>
diff --git a/interface/web/sites/lib/lang/cz_web_backup_list.lng b/interface/web/sites/lib/lang/cz_web_backup_list.lng
index fab26651ed..b12225d6f5 100644
--- a/interface/web/sites/lib/lang/cz_web_backup_list.lng
+++ b/interface/web/sites/lib/lang/cz_web_backup_list.lng
@@ -10,6 +10,10 @@ $wb['restore_info_txt'] = 'Obnovení ze zálohy bylo zahájeno. Tato akce trvá
 $wb['restore_confirm_txt'] = 'Obnovení přepíše existující soubory na Vaší webové stránce. Opravdu chcete obnovit tuto zálohu ?';
 $wb['download_pending_txt'] = 'Shodný požadavek na vytvoření zálohy pro stažení již čeká ve frontě na serveru ke zpracování.';
 $wb['restore_pending_txt'] = 'Shodný požadavek na obnovu dat ze zálohy již čeká ve frontě na serveru ke zpracování.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['backup_type_mysql'] = 'MySQL Databáze';
 $wb['backup_type_web'] = 'Soubory webových stránek';
 ?>
diff --git a/interface/web/sites/lib/lang/de_web_backup_list.lng b/interface/web/sites/lib/lang/de_web_backup_list.lng
index 316743aea5..c08d2a0a7b 100644
--- a/interface/web/sites/lib/lang/de_web_backup_list.lng
+++ b/interface/web/sites/lib/lang/de_web_backup_list.lng
@@ -11,6 +11,10 @@ $wb['restore_confirm_txt'] = 'Die Wiederherstellung wird existierende Dateien in
 $wb['backup_type_mongodb'] = 'MongoDB Datenbank';
 $wb['download_pending_txt'] = 'Es liegt bereits ein Backup-Download-Job an.';
 $wb['restore_pending_txt'] = 'Es liegt bereits ein Backup-Wiederherstellungs-Job an.';
+$wb['delete_backup_txt'] = 'Backup löschen';
+$wb['delete_info_txt'] = 'Das Löschen des Backups hat begonnen. Diese Aktion kann bis zur Fertigstellung einige Minuten dauern.';
+$wb['delete_confirm_txt'] = 'Möchten Sie dieses Backup wirklich löschen?';
+$wb['delete_pending_txt'] = 'Es liegt bereits ein Backup-Lösch-Job an.';
 $wb['backup_type_mysql'] = 'MySQL-Datenbank';
 $wb['backup_type_web'] = 'Webseiten-Dateien';
 ?>
diff --git a/interface/web/sites/lib/lang/el_web_backup_list.lng b/interface/web/sites/lib/lang/el_web_backup_list.lng
index 9a10ca6d07..fa4a59b403 100644
--- a/interface/web/sites/lib/lang/el_web_backup_list.lng
+++ b/interface/web/sites/lib/lang/el_web_backup_list.lng
@@ -10,6 +10,10 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring will overwrite existing files in your website. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['backup_type_mysql'] = 'MySQL Database';
 $wb['backup_type_web'] = 'Website files';
 ?>
diff --git a/interface/web/sites/lib/lang/en_web_backup_list.lng b/interface/web/sites/lib/lang/en_web_backup_list.lng
index 47ca0cb41d..6ec5f5f3c7 100644
--- a/interface/web/sites/lib/lang/en_web_backup_list.lng
+++ b/interface/web/sites/lib/lang/en_web_backup_list.lng
@@ -11,6 +11,10 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring will overwrite existing files in your website. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['backup_type_mongodb'] = 'MongoDB Database';
 $wb['backup_type_mysql'] = 'MySQL Database';
 $wb['backup_type_web'] = 'Website files';
diff --git a/interface/web/sites/lib/lang/es_web_backup_list.lng b/interface/web/sites/lib/lang/es_web_backup_list.lng
index 65e7135388..71a5cb1406 100644
--- a/interface/web/sites/lib/lang/es_web_backup_list.lng
+++ b/interface/web/sites/lib/lang/es_web_backup_list.lng
@@ -1,4 +1,5 @@
 <?php
+<<<<<<< HEAD
 $wb['list_head_txt'] = 'Respaldos existentes';
 $wb['date_txt'] = 'Fecha';
 $wb['backup_type_txt'] = 'Tipo';
@@ -10,6 +11,10 @@ $wb['restore_info_txt'] = 'La restauración del respaldo ha sido iniciada. Esta
 $wb['restore_confirm_txt'] = 'La restauración sobreescribirá los archivos en el sitio web. Realmente desea restaurar este respaldo?';
 $wb['download_pending_txt'] = 'Ya existe un trabajo pendiente para descarga de respaldo.';
 $wb['restore_pending_txt'] = 'Ya existe un trabajo pendiente para restauración de respaldo.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['backup_type_mysql'] = 'Base de datos MySQL';
 $wb['backup_type_web'] = 'Archivos del sitio web';
 ?>
diff --git a/interface/web/sites/lib/lang/fi_web_backup_list.lng b/interface/web/sites/lib/lang/fi_web_backup_list.lng
index 9a10ca6d07..fa4a59b403 100644
--- a/interface/web/sites/lib/lang/fi_web_backup_list.lng
+++ b/interface/web/sites/lib/lang/fi_web_backup_list.lng
@@ -10,6 +10,10 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring will overwrite existing files in your website. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['backup_type_mysql'] = 'MySQL Database';
 $wb['backup_type_web'] = 'Website files';
 ?>
diff --git a/interface/web/sites/lib/lang/fr_web_backup_list.lng b/interface/web/sites/lib/lang/fr_web_backup_list.lng
index 9a10ca6d07..fa4a59b403 100644
--- a/interface/web/sites/lib/lang/fr_web_backup_list.lng
+++ b/interface/web/sites/lib/lang/fr_web_backup_list.lng
@@ -10,6 +10,10 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring will overwrite existing files in your website. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['backup_type_mysql'] = 'MySQL Database';
 $wb['backup_type_web'] = 'Website files';
 ?>
diff --git a/interface/web/sites/lib/lang/hr_web_backup_list.lng b/interface/web/sites/lib/lang/hr_web_backup_list.lng
index a57b467e07..cd990f3e11 100644
--- a/interface/web/sites/lib/lang/hr_web_backup_list.lng
+++ b/interface/web/sites/lib/lang/hr_web_backup_list.lng
@@ -10,6 +10,10 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring will overwrite existing files in your website. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['backup_type_mysql'] = 'MySQL Database';
 $wb['backup_type_web'] = 'Website files';
 ?>
diff --git a/interface/web/sites/lib/lang/hu_web_backup_list.lng b/interface/web/sites/lib/lang/hu_web_backup_list.lng
index 9a10ca6d07..fa4a59b403 100644
--- a/interface/web/sites/lib/lang/hu_web_backup_list.lng
+++ b/interface/web/sites/lib/lang/hu_web_backup_list.lng
@@ -10,6 +10,10 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring will overwrite existing files in your website. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['backup_type_mysql'] = 'MySQL Database';
 $wb['backup_type_web'] = 'Website files';
 ?>
diff --git a/interface/web/sites/lib/lang/id_web_backup_list.lng b/interface/web/sites/lib/lang/id_web_backup_list.lng
index 9a10ca6d07..fa4a59b403 100644
--- a/interface/web/sites/lib/lang/id_web_backup_list.lng
+++ b/interface/web/sites/lib/lang/id_web_backup_list.lng
@@ -10,6 +10,10 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring will overwrite existing files in your website. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['backup_type_mysql'] = 'MySQL Database';
 $wb['backup_type_web'] = 'Website files';
 ?>
diff --git a/interface/web/sites/lib/lang/it_web_backup_list.lng b/interface/web/sites/lib/lang/it_web_backup_list.lng
index 9a10ca6d07..fa4a59b403 100644
--- a/interface/web/sites/lib/lang/it_web_backup_list.lng
+++ b/interface/web/sites/lib/lang/it_web_backup_list.lng
@@ -10,6 +10,10 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring will overwrite existing files in your website. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['backup_type_mysql'] = 'MySQL Database';
 $wb['backup_type_web'] = 'Website files';
 ?>
diff --git a/interface/web/sites/lib/lang/ja_web_backup_list.lng b/interface/web/sites/lib/lang/ja_web_backup_list.lng
index 9a10ca6d07..fa4a59b403 100644
--- a/interface/web/sites/lib/lang/ja_web_backup_list.lng
+++ b/interface/web/sites/lib/lang/ja_web_backup_list.lng
@@ -10,6 +10,10 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring will overwrite existing files in your website. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['backup_type_mysql'] = 'MySQL Database';
 $wb['backup_type_web'] = 'Website files';
 ?>
diff --git a/interface/web/sites/lib/lang/nl_web_backup_list.lng b/interface/web/sites/lib/lang/nl_web_backup_list.lng
index 9a10ca6d07..fa4a59b403 100644
--- a/interface/web/sites/lib/lang/nl_web_backup_list.lng
+++ b/interface/web/sites/lib/lang/nl_web_backup_list.lng
@@ -10,6 +10,10 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring will overwrite existing files in your website. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['backup_type_mysql'] = 'MySQL Database';
 $wb['backup_type_web'] = 'Website files';
 ?>
diff --git a/interface/web/sites/lib/lang/pl_web_backup_list.lng b/interface/web/sites/lib/lang/pl_web_backup_list.lng
index 401ee655f9..9c01ed0435 100644
--- a/interface/web/sites/lib/lang/pl_web_backup_list.lng
+++ b/interface/web/sites/lib/lang/pl_web_backup_list.lng
@@ -10,6 +10,10 @@ $wb['restore_info_txt'] = 'Rozpoczęło się odtwarzanie z kopii plików strony.
 $wb['restore_confirm_txt'] = 'Przywrócenie danych z kopii zapasowej zastąpi wszystkie obecnie istniejące pliki. Czy na pewno chcesz to zrobić?';
 $wb['download_pending_txt'] = 'Trwa już jedno zadanie pobrania kopii.';
 $wb['restore_pending_txt'] = 'Trwa już jedno zadanie przywrócenia danych z kopii.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['backup_type_mysql'] = 'Baza MySQL';
 $wb['backup_type_web'] = 'Pliki strony';
 ?>
diff --git a/interface/web/sites/lib/lang/pt_web_backup_list.lng b/interface/web/sites/lib/lang/pt_web_backup_list.lng
index 9a10ca6d07..fa4a59b403 100644
--- a/interface/web/sites/lib/lang/pt_web_backup_list.lng
+++ b/interface/web/sites/lib/lang/pt_web_backup_list.lng
@@ -10,6 +10,10 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring will overwrite existing files in your website. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['backup_type_mysql'] = 'MySQL Database';
 $wb['backup_type_web'] = 'Website files';
 ?>
diff --git a/interface/web/sites/lib/lang/ro_web_backup_list.lng b/interface/web/sites/lib/lang/ro_web_backup_list.lng
index 9a10ca6d07..fa4a59b403 100644
--- a/interface/web/sites/lib/lang/ro_web_backup_list.lng
+++ b/interface/web/sites/lib/lang/ro_web_backup_list.lng
@@ -10,6 +10,10 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring will overwrite existing files in your website. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['backup_type_mysql'] = 'MySQL Database';
 $wb['backup_type_web'] = 'Website files';
 ?>
diff --git a/interface/web/sites/lib/lang/ru_web_backup_list.lng b/interface/web/sites/lib/lang/ru_web_backup_list.lng
index 9a10ca6d07..fa4a59b403 100644
--- a/interface/web/sites/lib/lang/ru_web_backup_list.lng
+++ b/interface/web/sites/lib/lang/ru_web_backup_list.lng
@@ -10,6 +10,10 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring will overwrite existing files in your website. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['backup_type_mysql'] = 'MySQL Database';
 $wb['backup_type_web'] = 'Website files';
 ?>
diff --git a/interface/web/sites/lib/lang/se_web_backup_list.lng b/interface/web/sites/lib/lang/se_web_backup_list.lng
index e74395302a..19ae414f85 100644
--- a/interface/web/sites/lib/lang/se_web_backup_list.lng
+++ b/interface/web/sites/lib/lang/se_web_backup_list.lng
@@ -10,6 +10,10 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring will overwrite existing files in your website. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['backup_type_mysql'] = 'MySQL-databaser';
 $wb['backup_type_web'] = 'Webbsidefiler';
 ?>
diff --git a/interface/web/sites/lib/lang/sk_web_backup_list.lng b/interface/web/sites/lib/lang/sk_web_backup_list.lng
index 9a10ca6d07..fa4a59b403 100644
--- a/interface/web/sites/lib/lang/sk_web_backup_list.lng
+++ b/interface/web/sites/lib/lang/sk_web_backup_list.lng
@@ -10,6 +10,10 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
 $wb['restore_confirm_txt'] = 'Restoring will overwrite existing files in your website. Do you really want to restore this backup?';
 $wb['download_pending_txt'] = 'There is already a pending backup download job.';
 $wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['backup_type_mysql'] = 'MySQL Database';
 $wb['backup_type_web'] = 'Website files';
 ?>
diff --git a/interface/web/sites/lib/lang/tr_web_backup_list.lng b/interface/web/sites/lib/lang/tr_web_backup_list.lng
index f2265d9a54..c58cd648a0 100644
--- a/interface/web/sites/lib/lang/tr_web_backup_list.lng
+++ b/interface/web/sites/lib/lang/tr_web_backup_list.lng
@@ -1,4 +1,5 @@
 <?php
+<<<<<<< HEAD
 $wb['list_head_txt'] = 'Alınmış Yedekler';
 $wb['date_txt'] = 'Tarih';
 $wb['backup_type_txt'] = 'Tip';
@@ -11,6 +12,9 @@ $wb['restore_confirm_txt'] = 'Geri yükleme işlemi web sitenizde bulunan dosyal
 $wb['download_pending_txt'] = 'Zaten bekleyen bir yedek indirme iÅŸlemi var.';
 $wb['restore_pending_txt'] = 'Zaten bekleyen bir yedek geri yükleme işlemi var.';
 $wb['backup_type_mysql'] = 'MySQL Veritabanı';
+$wb['delete_backup_txt'] = 'Delete Backup';
+$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
+$wb['delete_confirm_txt'] = 'Really delete this backup?';
+$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
 $wb['backup_type_web'] = 'Web sitesi dosyaları';
-
 ?>
diff --git a/interface/web/sites/templates/web_backup_list.htm b/interface/web/sites/templates/web_backup_list.htm
index d933d64f37..c040b38ea6 100644
--- a/interface/web/sites/templates/web_backup_list.htm
+++ b/interface/web/sites/templates/web_backup_list.htm
@@ -32,6 +32,7 @@
                                     <tmpl_if name="download_available">
 										<button class="btn btn-default formbutton-default" type="button" data-load-content="sites/web_vhost_domain_edit.php?id={tmpl_var name='parent_id'}&next_tab=backup&backup_action=download&backup_id={tmpl_var name='backup_id'}">{tmpl_var name="download_backup_txt"}</button>
 									</tmpl_if>
+									<button class="button iconstxt icoDelete" type="button" onclick="confirm_action('sites/web_domain_edit.php?id={tmpl_var name='parent_id'}&next_tab=backup&backup_action=delete&backup_id={tmpl_var name='backup_id'}','{tmpl_var name='delete_confirm_txt'}');"><span>{tmpl_var name="delete_backup_txt"}</span></button>
                                 </div>
                             </td>
                         </tr>
diff --git a/server/lib/classes/cron.d/500-backup_mail.inc.php b/server/lib/classes/cron.d/500-backup_mail.inc.php
index 1b73a99db1..68795551e9 100644
--- a/server/lib/classes/cron.d/500-backup_mail.inc.php
+++ b/server/lib/classes/cron.d/500-backup_mail.inc.php
@@ -219,6 +219,20 @@ class cronjob_backup_mail extends cronjob {
 
 					}
 				}
+
+				// remove non-existing backups from database
+				$backups = $app->db->queryAllRecords("SELECT * FROM mail_backup WHERE server_id = ?", $conf['server_id']);
+				if(is_array($backups) && !empty($backups)){
+					foreach($backups as $backup){
+						$mail_backup_dir = $backup_dir.'/mail'.$rec['domain_id'];
+						$mail_backup_file = 'mail'.$rec['mailuser_id'].'_*';
+						if(!is_file($mail_backup_dir.'/'.$mail_backup_file)){
+							$sql = "DELETE FROM mail_backup WHERE server_id = ? AND parent_domain_id = ? AND filename = ?";
+							$app->db->query($sql, $conf['server_id'], $backup['parent_domain_id'], $backup['filename']);
+							if($app->db->dbHost != $app->dbmaster->dbHost) $app->dbmaster->query($sql);
+						}
+					}
+				}
 				if( $server_config['backup_dir_is_mount'] == 'y' ) $app->system->umount_backup_dir($backup_dir);
 				//* end run_backups
 			}
diff --git a/server/plugins-available/backup_plugin.inc.php b/server/plugins-available/backup_plugin.inc.php
index 0da8e35547..167ef420e6 100644
--- a/server/plugins-available/backup_plugin.inc.php
+++ b/server/plugins-available/backup_plugin.inc.php
@@ -53,9 +53,10 @@ class backup_plugin {
 		//* Register for actions
 		$app->plugins->registerAction('backup_download', $this->plugin_name, 'backup_action');
 		$app->plugins->registerAction('backup_restore', $this->plugin_name, 'backup_action');
+		$app->plugins->registerAction('backup_delete', $this->plugin_name, 'backup_action');
 		//$app->plugins->registerAction('backup_download_mail', $this->plugin_name, 'backup_action_mail');
 		$app->plugins->registerAction('backup_restore_mail', $this->plugin_name, 'backup_action_mail');
-		
+		$app->plugins->registerAction('backup_delete_mail', $this->plugin_name, 'backup_action_mail');
 	}
 
 	//* Do a backup action
@@ -160,6 +161,18 @@ class backup_plugin {
 					}
 					$app->system->web_folder_protection($web['document_root'], true);
 				}
+				
+				if($action_name == 'backup_delete') {
+					if(file_exists($backup_dir.'/'.$backup['filename']) && !stristr($backup_dir.'/'.$backup['filename'], '..') && !stristr($backup_dir.'/'.$backup['filename'], 'etc')) {
+						unlink($backup_dir.'/'.$backup['filename']);
+						
+						$sql = "DELETE FROM mail_backup WHERE server_id = ? AND parent_domain_id = ? AND filename = ?";
+						$app->db->query($sql, $conf['server_id'], $backup['parent_domain_id'], $backup['filename']);
+						if($app->db->dbHost != $app->dbmaster->dbHost) $app->dbmaster->query($sql);
+						$app->log('unlink '.$backup_dir.'/'.$backup['filename'], LOGLEVEL_DEBUG);
+					}
+				}
+
 				if( $server_config['backup_dir_is_mount'] == 'y' ) $app->system->umount_backup_dir($backup_dir);
 			} else {
 				$app->log('Backup directory not ready.', LOGLEVEL_DEBUG);
@@ -178,14 +191,11 @@ class backup_plugin {
 		$backup_id = intval($data);
 		$mail_backup = $app->dbmaster->queryOneRecord("SELECT * FROM mail_backup WHERE backup_id = ?", $backup_id);
 	
-		if (is_array($mail_backup) && $action_name == 'backup_restore_mail') {
+		if (is_array($mail_backup)) {
 			$app->uses('ini_parser,file,getconf');
 	
 			$server_config = $app->getconf->get_server_config($conf['server_id'], 'server');
-			$backup_dir = trim($server_config['backup_dir']);
-
-            if($backup_dir == '') return;
-
+			$backup_dir = $server_config['backup_dir'];
 			$backup_dir_is_ready = true;
 	
 			//* mount backup directory, if necessary
@@ -217,65 +227,78 @@ class backup_plugin {
 					chgrp($record['maildir'], $mail_config['mailuser_group']);
 				}
 			
-				if(file_exists($mail_backup_file) && $record['homedir'] != '' && $record['homedir'] != '/' && !stristr($mail_backup_file,'..') && !stristr($mail_backup_file,'etc') && $mail_config['homedir_path'] == $record['homedir'] && is_dir($domain_dir) && is_dir($record['maildir'])) {
-					if ($record['maildir_format'] == 'mdbox') {
-						$retval = -1;
-						// First unzip backupfile to local backup-folder
-						if($mail_backup['backup_mode'] == 'userzip') {
-							copy($mail_backup_file, $record['maildir'].'/'.$mail_backup['filename']);
-							chgrp($record['maildir'].'/'.$mail_backup['filename'], $mail_config['mailuser_group']);
-							$command = 'sudo -u '.$mail_config['mailuser_name'].' unzip -qq -o  '.escapeshellarg($record['maildir'].'/'.$mail_backup['filename']).' -d '.escapeshellarg($record['maildir']).' 2> /dev/null';
-							exec($command,$tmp_output, $retval);
-							unlink($record['maildir'].'/'.$mail_backup['filename']);
-						}
-						if($mail_backup['backup_mode'] == 'rootgz') {
-							$command='tar xfz '.escapeshellarg($mail_backup_file).' --directory '.escapeshellarg($record['maildir']);
-							exec($command,$tmp_output, $retval);
-						}
-						
-						if($retval == 0) {
-							// Now import backup-mailbox into special backup-folder
-							$backupname = "backup-".date("Y-m-d", $mail_backup['tstamp']);
-							exec("doveadm mailbox create -u \"".$record["email"]."\" $backupname");
-							exec("doveadm import -u \"".$record["email"]."\" mdbox:".$record['maildir']."/backup $backupname all", $tmp_output, $retval);
-							exec("for f in `doveadm mailbox list -u \"".$record["email"]."\" $backupname*`; do doveadm mailbox subscribe -u \"".$record["email"]."\" \$f; done", $tmp_output, $retval);
-							exec('rm -rf '.$record['maildir'].'/backup');
-						}
-						
-						if($retval == 0){
-							$app->log('Restored Mail backup '.$mail_backup_file,LOGLEVEL_DEBUG);
-						} else {
-							// cleanup
-							if (file_exists($record['maildir'].'/'.$mail_backup['filename'])) unlink($record['maildir'].'/'.$mail_backup['filename']);
-							if (file_exists($record['maildir']."/backup")) exec('rm -rf '.$record['maildir']."/backup");
+				if ($action_name == 'backup_restore_mail') {
+					if(file_exists($mail_backup_file) && $record['homedir'] != '' && $record['homedir'] != '/' && !stristr($mail_backup_file,'..') && !stristr($mail_backup_file,'etc') && $mail_config['homedir_path'] == $record['homedir'] && is_dir($domain_dir) && is_dir($record['maildir'])) {
+						if ($record['maildir_format'] == 'mdbox') {
+							$retval = -1;
+							// First unzip backupfile to local backup-folder
+							if($mail_backup['backup_mode'] == 'userzip') {
+								copy($mail_backup_file, $record['maildir'].'/'.$mail_backup['filename']);
+								chgrp($record['maildir'].'/'.$mail_backup['filename'], $mail_config['mailuser_group']);
+								$command = 'sudo -u '.$mail_config['mailuser_name'].' unzip -qq -o  '.escapeshellarg($record['maildir'].'/'.$mail_backup['filename']).' -d '.escapeshellarg($record['maildir']).' 2> /dev/null';
+								exec($command,$tmp_output, $retval);
+								unlink($record['maildir'].'/'.$mail_backup['filename']);
+							}
+							if($mail_backup['backup_mode'] == 'rootgz') {
+								$command='tar xfz '.escapeshellarg($mail_backup_file).' --directory '.escapeshellarg($record['maildir']);
+								exec($command,$tmp_output, $retval);
+							}
+							
+							if($retval == 0) {
+								// Now import backup-mailbox into special backup-folder
+								$backupname = "backup-".date("Y-m-d", $mail_backup['tstamp']);
+								exec("doveadm mailbox create -u \"".$record["email"]."\" $backupname");
+								exec("doveadm import -u \"".$record["email"]."\" mdbox:".$record['maildir']."/backup $backupname all", $tmp_output, $retval);
+								exec("for f in `doveadm mailbox list -u \"".$record["email"]."\" $backupname*`; do doveadm mailbox subscribe -u \"".$record["email"]."\" \$f; done", $tmp_output, $retval);
+								exec('rm -rf '.$record['maildir'].'/backup');
+							}
 							
-							$app->log('Unable to restore Mail backup '.$mail_backup_file.' '.$tmp_output,LOGLEVEL_ERROR);
-						}
-					}
-					else {
-						if($mail_backup['backup_mode'] == 'userzip') {
-							copy($mail_backup_file, $domain_dir.'/'.$mail_backup['filename']);
-							chgrp($domain_dir.'/'.$mail_backup['filename'], $mail_config['mailuser_group']);
-							$command = 'sudo -u '.$mail_config['mailuser_name'].' unzip -qq -o  '.escapeshellarg($domain_dir.'/'.$mail_backup['filename']).' -d '.escapeshellarg($domain_dir).' 2> /dev/null';
-							exec($command,$tmp_output, $retval);
-							unlink($domain_dir.'/'.$mail_backup['filename']);
 							if($retval == 0){
 								$app->log('Restored Mail backup '.$mail_backup_file,LOGLEVEL_DEBUG);
 							} else {
+								// cleanup
+								if (file_exists($record['maildir'].'/'.$mail_backup['filename'])) unlink($record['maildir'].'/'.$mail_backup['filename']);
+								if (file_exists($record['maildir']."/backup")) exec('rm -rf '.$record['maildir']."/backup");
+								
 								$app->log('Unable to restore Mail backup '.$mail_backup_file.' '.$tmp_output,LOGLEVEL_ERROR);
 							}
 						}
-						if($mail_backup['backup_mode'] == 'rootgz') {
-							$command='tar xfz '.escapeshellarg($mail_backup_file).' --directory '.escapeshellarg($domain_dir);
-							exec($command,$tmp_output, $retval);
-							if($retval == 0){
-								$app->log('Restored Mail backup '.$mail_backup_file,LOGLEVEL_DEBUG);
-							} else {
-								$app->log('Unable to restore Mail backup '.$mail_backup_file.' '.$tmp_output,LOGLEVEL_ERROR);
+						else {
+							if($mail_backup['backup_mode'] == 'userzip') {
+								copy($mail_backup_file, $domain_dir.'/'.$mail_backup['filename']);
+								chgrp($domain_dir.'/'.$mail_backup['filename'], $mail_config['mailuser_group']);
+								$command = 'sudo -u '.$mail_config['mailuser_name'].' unzip -qq -o  '.escapeshellarg($domain_dir.'/'.$mail_backup['filename']).' -d '.escapeshellarg($domain_dir).' 2> /dev/null';
+								exec($command,$tmp_output, $retval);
+								unlink($domain_dir.'/'.$mail_backup['filename']);
+								if($retval == 0){
+									$app->log('Restored Mail backup '.$mail_backup_file,LOGLEVEL_DEBUG);
+								} else {
+									$app->log('Unable to restore Mail backup '.$mail_backup_file.' '.$tmp_output,LOGLEVEL_ERROR);
+								}
+							}
+							if($mail_backup['backup_mode'] == 'rootgz') {
+								$command='tar xfz '.escapeshellarg($mail_backup_file).' --directory '.escapeshellarg($domain_dir);
+								exec($command,$tmp_output, $retval);
+								if($retval == 0){
+									$app->log('Restored Mail backup '.$mail_backup_file,LOGLEVEL_DEBUG);
+								} else {
+									$app->log('Unable to restore Mail backup '.$mail_backup_file.' '.$tmp_output,LOGLEVEL_ERROR);
+								}
 							}
 						}
 					}
 				}
+				
+				if($action_name == 'backup_delete_mail') {
+					if(file_exists($mail_backup_file) && !stristr($mail_backup_file, '..') && !stristr($mail_backup_file, 'etc')) {
+						unlink($mail_backup_file);
+						$sql = "DELETE FROM mail_backup WHERE server_id = ? AND parent_domain_id = ? AND filename = ?";
+						$app->db->query($sql, $conf['server_id'], $mail_backup['parent_domain_id'], $mail_backup['filename']);
+						if($app->db->dbHost != $app->dbmaster->dbHost) $app->dbmaster->query($sql);
+						$app->log('unlink '.$backup_dir.'/'.$mail_backup['filename'], LOGLEVEL_DEBUG);
+					}
+				}
+				
 				if( $server_config['backup_dir_is_mount'] == 'y' ) $app->system->umount_backup_dir($backup_dir);
 			} else {
 				$app->log('Backup directory not ready.', LOGLEVEL_DEBUG);
-- 
GitLab