Skip to content

Commit 8938c85

Browse files
author
Marius Cramer
committed
Merge branch 'master' into 'master'
Master Added possibility to delete backups manually See merge request !246
2 parents a5714c3 + aa365c4 commit 8938c85

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

+301
-61
lines changed

interface/lib/classes/plugin_backuplist.inc.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ function onShow() {
8585
$server_id = $this->form->dataRecord['server_id'];
8686
$backup = $app->db->queryOneRecord("SELECT * FROM web_backup WHERE backup_id = ?", $backup_id);
8787
if($backup['server_id'] > 0) $server_id = $backup['server_id'];
88-
$sql = "SELECT count(action_id) as number FROM sys_remoteaction WHERE action_state = 'pending' AND action_type = 'backup_restore' AND action_param = '$backup_id'";
89-
$tmp = $app->db->queryOneRecord($sql);
88+
$sql = "SELECT count(action_id) as number FROM sys_remoteaction WHERE action_state = 'pending' AND action_type = 'backup_restore' AND action_param = ?";
89+
$tmp = $app->db->queryOneRecord($sql, $backup_id);
9090
if($tmp['number'] == 0) {
9191
$message .= $wb['restore_info_txt'];
9292
$sql = "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
@@ -96,6 +96,21 @@ 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 = ?";
104+
$tmp = $app->db->queryOneRecord($sql, $backup_id);
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 (?, UNIX_TIMESTAMP(), 'backup_delete', ?, 'pending', '')";
109+
$app->db->query($sql, $server_id, $backup_id);
110+
} else {
111+
$error .= $wb['delete_pending_txt'];
112+
}
113+
}
99114

100115
}
101116

interface/lib/classes/plugin_backuplist_mail.inc.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,24 @@ function onShow() {
6262
if($tmp['number'] == 0) {
6363
$message .= $wb['restore_info_txt'];
6464
$sql = "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
65-
"VALUES (?, ? 'backup_restore_mail', ?, 'pending','')";
65+
"VALUES (?, ?, 'backup_restore_mail', ?, 'pending','')";
6666
$app->db->query($sql, $this->form->dataRecord['server_id'], time(), $backup_id);
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 (?, ?, 'backup_delete_mail, ?, 'pending', '')";
79+
$app->db->query($sql, $this->form->dataRecord['server_id'], time(), $backup_id);
80+
} else {
81+
$error .= $wb['delete_pending_txt'];
82+
}
7083
}
7184
}
7285

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)