Commit aa1eed46 authored by Ramil Valitov's avatar Ramil Valitov Committed by Marius Burkard
Browse files

Feature/backup copies

parent 2cc5f036
......@@ -469,7 +469,7 @@ if ($backup_available) {
'datatype' => 'INTEGER',
'formtype' => 'SELECT',
'default' => '',
'value' => array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10')
'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')
),
##################################
# END Datatable fields
......
......@@ -668,7 +668,7 @@ if ($backup_available) {
'datatype' => 'INTEGER',
'formtype' => 'SELECT',
'default' => '',
'value' => array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10')
'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')
),
'backup_excludes' => array (
'datatype' => 'VARCHAR',
......
......@@ -33,6 +33,11 @@ class cronjob_backup extends cronjob {
// job schedule
protected $_schedule = '0 0 * * *';
/**
* The maximum number of backups that ISPConfig can store.
*/
const max_backups = 30;
/* this function is optional if it contains no custom code */
public function onPrepare() {
global $app;
......@@ -177,7 +182,7 @@ class cronjob_backup extends cronjob {
rsort($files);
for ($n = $backup_copies; $n <= 10; $n++) {
for ($n = $backup_copies; $n <= self::max_backups; $n++) {
if(isset($files[$n]) && is_file($web_backup_dir.'/'.$files[$n])) {
$sql = "DELETE FROM web_backup WHERE server_id = ? AND parent_domain_id = ? AND filename = ?";
$app->db->query($sql, $conf['server_id'], $web_id, $files[$n]);
......@@ -306,7 +311,7 @@ class cronjob_backup extends cronjob {
reset($files);
foreach($files as $db_name => $filelist) {
rsort($filelist);
for ($n = $backup_copies; $n <= 10; $n++) {
for ($n = $backup_copies; $n <= self::max_backups; $n++) {
if(isset($filelist[$n]) && is_file($db_backup_dir.'/'.$filelist[$n])) {
$sql = "DELETE FROM web_backup WHERE server_id = ? AND parent_domain_id = ? AND filename = ?";
$app->db->query($sql, $conf['server_id'], $web_id, $filelist[$n]);
......
......@@ -33,6 +33,11 @@ class cronjob_backup_mail extends cronjob {
protected $_schedule = '0 0 * * *';
private $tmp_backup_dir = '';
/**
* The maximum number of backups that ISPConfig can store.
*/
const max_backups = 30;
/* this function is optional if it contains no custom code */
public function onPrepare() {
global $app;
......@@ -204,7 +209,7 @@ class cronjob_backup_mail extends cronjob {
}
$dir_handle->close();
rsort($files);
for ($n = $backup_copies; $n <= 10; $n++) {
for ($n = $backup_copies; $n <= self::max_backups; $n++) {
if(isset($files[$n]) && is_file($mail_backup_dir.'/'.$files[$n])) {
unlink($mail_backup_dir.'/'.$files[$n]);
$sql = "DELETE FROM mail_backup WHERE server_id = ? AND parent_domain_id = ? AND filename = ?";
......
Supports Markdown
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