Skip to content

Commit 634132a

Browse files
Dominikroot
authored andcommitted
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
1 parent a5714c3 commit 634132a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+312
-58
lines changed

interface/lib/classes/plugin_backuplist.inc.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,28 @@ function onShow() {
9696
$error .= $wb['restore_pending_txt'];
9797
}
9898
}
99+
if($_GET['backup_action'] == 'delete' && $backup_id > 0) {
100+
$server_id = $this->form->dataRecord['server_id'];
101+
$backup = $app->db->queryOneRecord("SELECT * FROM web_backup WHERE backup_id = ".$backup_id);
102+
if($backup['server_id'] > 0) $server_id = $backup['server_id'];
103+
$sql = "SELECT count(action_id) as number FROM sys_remoteaction WHERE action_state = 'pending' AND action_type = 'backup_delete' AND action_param = '$backup_id'";
104+
$tmp = $app->db->queryOneRecord($sql);
105+
if($tmp['number'] == 0) {
106+
$message .= $wb['delete_info_txt'];
107+
$sql = "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
108+
"VALUES (".
109+
(int)$server_id . ", " .
110+
time() . ", " .
111+
"'backup_delete', " .
112+
"'".$backup_id."', " .
113+
"'pending', " .
114+
"''" .
115+
")";
116+
$app->db->query($sql);
117+
} else {
118+
$error .= $wb['delete_pending_txt'];
119+
}
120+
}
99121

100122
}
101123

interface/lib/classes/plugin_backuplist_mail.inc.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,26 @@ function onShow() {
6767
} else {
6868
$error .= $wb['restore_pending_txt'];
6969
}
70+
}
71+
72+
if($_GET['backup_action'] == 'delete_mail' && $backup_id > 0) {
73+
$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'";
74+
$tmp = $app->db->queryOneRecord($sql);
75+
if($tmp['number'] == 0) {
76+
$message .= $wb['delete_info_txt'];
77+
$sql = "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
78+
"VALUES (".
79+
(int)$this->form->dataRecord['server_id'] . ", " .
80+
time() . ", " .
81+
"'backup_delete_mail', " .
82+
"'".$backup_id."', " .
83+
"'pending', " .
84+
"''" .
85+
")";
86+
$app->db->query($sql);
87+
} else {
88+
$error .= $wb['delete_pending_txt'];
89+
}
7090
}
7191
}
7292

interface/lib/classes/remote.d/mail.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ public function mail_user_backup($session_id, $primary_id, $action_type)
357357
return false;
358358
}
359359

360-
if (/*$action_type != 'backup_download_mail' and*/ $action_type != 'backup_restore_mail') {
360+
if (/*$action_type != 'backup_download_mail' and*/ $action_type != 'backup_restore_mail' and $action_type != 'backup_delete_mail') {
361361
$this->server->fault('invalid_action', "Invalid action_type $action_type");
362362
return false;
363363
}

interface/lib/classes/remote.d/sites.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ public function sites_web_domain_backup($session_id, $primary_id, $action_type)
931931
return false;
932932
}
933933

934-
if ($action_type != 'backup_download' and $action_type != 'backup_restore') {
934+
if ($action_type != 'backup_download' and $action_type != 'backup_restore' and $action_type != 'backup_delete') {
935935
$this->server->fault('invalid_action', "Invalid action_type $action_type");
936936
return false;
937937
}

interface/web/mail/lib/lang/ar_mail_backup_list.lng

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,9 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
88
$wb['restore_confirm_txt'] = 'Restoring may overwrite existing files in your mailbox. Do you really want to restore this backup?';
99
$wb['download_pending_txt'] = 'There is already a pending backup download job.';
1010
$wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
11+
$wb['delete_backup_txt'] = 'Delete Backup';
12+
$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
13+
$wb['delete_confirm_txt'] = 'Really delete this backup?';
14+
$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
1115
$wb['filesize_txt'] = 'Filesize';
1216
?>

interface/web/mail/lib/lang/bg_mail_backup_list.lng

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,9 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
88
$wb['restore_confirm_txt'] = 'Restoring may overwrite existing files in your mailbox. Do you really want to restore this backup?';
99
$wb['download_pending_txt'] = 'There is already a pending backup download job.';
1010
$wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
11+
$wb['delete_backup_txt'] = 'Delete Backup';
12+
$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
13+
$wb['delete_confirm_txt'] = 'Really delete this backup?';
14+
$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
1115
$wb['filesize_txt'] = 'Filesize';
1216
?>

interface/web/mail/lib/lang/br_mail_backup_list.lng

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,9 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
88
$wb['restore_confirm_txt'] = 'Restoring may overwrite existing files in your mailbox. Do you really want to restore this backup?';
99
$wb['download_pending_txt'] = 'There is already a pending backup download job.';
1010
$wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
11+
$wb['delete_backup_txt'] = 'Delete Backup';
12+
$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
13+
$wb['delete_confirm_txt'] = 'Really delete this backup?';
14+
$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
1115
$wb['filesize_txt'] = 'Filesize';
1216
?>

interface/web/mail/lib/lang/cz_mail_backup_list.lng

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,9 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
88
$wb['restore_confirm_txt'] = 'Restoring may overwrite existing files in your mailbox. Do you really want to restore this backup?';
99
$wb['download_pending_txt'] = 'There is already a pending backup download job.';
1010
$wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
11+
$wb['delete_backup_txt'] = 'Delete Backup';
12+
$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
13+
$wb['delete_confirm_txt'] = 'Really delete this backup?';
14+
$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
1115
$wb['filesize_txt'] = 'Filesize';
1216
?>

interface/web/mail/lib/lang/de_mail_backup_list.lng

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,9 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
88
$wb['restore_confirm_txt'] = 'Restoring may overwrite existing files in your mailbox. Do you really want to restore this backup?';
99
$wb['download_pending_txt'] = 'There is already a pending backup download job.';
1010
$wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
11+
$wb['delete_backup_txt'] = 'Delete Backup';
12+
$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
13+
$wb['delete_confirm_txt'] = 'Really delete this backup?';
14+
$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
1115
$wb['filesize_txt'] = 'Filesize';
1216
?>

interface/web/mail/lib/lang/el_mail_backup_list.lng

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,9 @@ $wb['restore_info_txt'] = 'Restore of the backup has been started. This action t
88
$wb['restore_confirm_txt'] = 'Restoring may overwrite existing files in your mailbox. Do you really want to restore this backup?';
99
$wb['download_pending_txt'] = 'There is already a pending backup download job.';
1010
$wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
11+
$wb['delete_backup_txt'] = 'Delete Backup';
12+
$wb['delete_info_txt'] = 'Delete of the backup has been started. This action takes several minutes to be completed.';
13+
$wb['delete_confirm_txt'] = 'Really delete this backup?';
14+
$wb['delete_pending_txt'] = 'There is already a pending backup delete job.';
1115
$wb['filesize_txt'] = 'Filesize';
1216
?>

0 commit comments

Comments
 (0)