Skip to content

Commit 3c8d69d

Browse files
author
Marius Burkard
committed
Merge branch 'feature/backup_copies' into 'stable-3.1'
Feature/backup copies See merge request ispconfig/ispconfig3!974
2 parents 621c847 + aa1eed4 commit 3c8d69d

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

interface/web/mail/form/mail_user.tform.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@
469469
'datatype' => 'INTEGER',
470470
'formtype' => 'SELECT',
471471
'default' => '',
472-
'value' => array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10')
472+
'value' => array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10', '15' => '15', '20' => '20', '30' => '30')
473473
),
474474
##################################
475475
# END Datatable fields

interface/web/sites/form/web_vhost_domain.tform.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@
668668
'datatype' => 'INTEGER',
669669
'formtype' => 'SELECT',
670670
'default' => '',
671-
'value' => array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10')
671+
'value' => array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10', '15' => '15', '20' => '20', '30' => '30')
672672
),
673673
'backup_excludes' => array (
674674
'datatype' => 'VARCHAR',

server/lib/classes/cron.d/500-backup.inc.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ class cronjob_backup extends cronjob {
3333
// job schedule
3434
protected $_schedule = '0 0 * * *';
3535

36+
/**
37+
* The maximum number of backups that ISPConfig can store.
38+
*/
39+
const max_backups = 30;
40+
3641
/* this function is optional if it contains no custom code */
3742
public function onPrepare() {
3843
global $app;
@@ -177,7 +182,7 @@ public function onRunJob() {
177182

178183
rsort($files);
179184

180-
for ($n = $backup_copies; $n <= 10; $n++) {
185+
for ($n = $backup_copies; $n <= self::max_backups; $n++) {
181186
if(isset($files[$n]) && is_file($web_backup_dir.'/'.$files[$n])) {
182187
$sql = "DELETE FROM web_backup WHERE server_id = ? AND parent_domain_id = ? AND filename = ?";
183188
$app->db->query($sql, $conf['server_id'], $web_id, $files[$n]);
@@ -306,7 +311,7 @@ public function onRunJob() {
306311
reset($files);
307312
foreach($files as $db_name => $filelist) {
308313
rsort($filelist);
309-
for ($n = $backup_copies; $n <= 10; $n++) {
314+
for ($n = $backup_copies; $n <= self::max_backups; $n++) {
310315
if(isset($filelist[$n]) && is_file($db_backup_dir.'/'.$filelist[$n])) {
311316
$sql = "DELETE FROM web_backup WHERE server_id = ? AND parent_domain_id = ? AND filename = ?";
312317
$app->db->query($sql, $conf['server_id'], $web_id, $filelist[$n]);

server/lib/classes/cron.d/500-backup_mail.inc.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ class cronjob_backup_mail extends cronjob {
3333
protected $_schedule = '0 0 * * *';
3434
private $tmp_backup_dir = '';
3535

36+
/**
37+
* The maximum number of backups that ISPConfig can store.
38+
*/
39+
const max_backups = 30;
40+
3641
/* this function is optional if it contains no custom code */
3742
public function onPrepare() {
3843
global $app;
@@ -204,7 +209,7 @@ public function onRunJob() {
204209
}
205210
$dir_handle->close();
206211
rsort($files);
207-
for ($n = $backup_copies; $n <= 10; $n++) {
212+
for ($n = $backup_copies; $n <= self::max_backups; $n++) {
208213
if(isset($files[$n]) && is_file($mail_backup_dir.'/'.$files[$n])) {
209214
unlink($mail_backup_dir.'/'.$files[$n]);
210215
$sql = "DELETE FROM mail_backup WHERE server_id = ? AND parent_domain_id = ? AND filename = ?";

0 commit comments

Comments
 (0)