Commit b48a0b43 authored by Florian Schaal's avatar Florian Schaal

allow empty backup-dir (to disable backups on a server, just empty the backup-dir)

parent aff9acb4
...@@ -169,9 +169,7 @@ $form["tabs"]['server'] = array( ...@@ -169,9 +169,7 @@ $form["tabs"]['server'] = array(
'datatype' => 'VARCHAR', 'datatype' => 'VARCHAR',
'formtype' => 'TEXT', 'formtype' => 'TEXT',
'default' => '/var/backup', 'default' => '/var/backup',
'validators' => array( 0 => array('type' => 'NOTEMPTY', 'validators' => array( 0 => array ( 'type' => 'REGEX',
'errmsg' => 'backup_dir_error_empty'),
1 => array ( 'type' => 'REGEX',
'regex' => '/^\/[a-zA-Z0-9\.\-\_\/]{5,128}$/', 'regex' => '/^\/[a-zA-Z0-9\.\-\_\/]{5,128}$/',
'errmsg'=> 'backup_dir_error_regex'), 'errmsg'=> 'backup_dir_error_regex'),
), ),
......
...@@ -52,7 +52,7 @@ class cronjob_backup extends cronjob { ...@@ -52,7 +52,7 @@ class cronjob_backup extends cronjob {
$server_config = $app->getconf->get_server_config($conf['server_id'], 'server'); $server_config = $app->getconf->get_server_config($conf['server_id'], 'server');
$global_config = $app->getconf->get_global_config('sites'); $global_config = $app->getconf->get_global_config('sites');
$backup_dir = $server_config['backup_dir']; $backup_dir = trim($server_config['backup_dir']);
$backup_mode = $server_config['backup_mode']; $backup_mode = $server_config['backup_mode'];
if($backup_mode == '') $backup_mode = 'userzip'; if($backup_mode == '') $backup_mode = 'userzip';
......
...@@ -54,7 +54,7 @@ class cronjob_backup_mail extends cronjob { ...@@ -54,7 +54,7 @@ class cronjob_backup_mail extends cronjob {
$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail'); $mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
$global_config = $app->getconf->get_global_config('sites'); $global_config = $app->getconf->get_global_config('sites');
$backup_dir = $server_config['backup_dir']; $backup_dir = trim($server_config['backup_dir']);
$backup_dir_permissions =0750; $backup_dir_permissions =0750;
$backup_mode = $server_config['backup_mode']; $backup_mode = $server_config['backup_mode'];
......
...@@ -71,7 +71,9 @@ class backup_plugin { ...@@ -71,7 +71,9 @@ class backup_plugin {
$web = $app->dbmaster->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ?", $backup['parent_domain_id']); $web = $app->dbmaster->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ?", $backup['parent_domain_id']);
$server_config = $app->getconf->get_server_config($conf['server_id'], 'server'); $server_config = $app->getconf->get_server_config($conf['server_id'], 'server');
$backup_dir = $server_config['backup_dir'].'/web'.$web['domain_id']; $backup_dir = trim($server_config['backup_dir']);
if($backup_dir == '') return;
$backup_dir .= '/web'.$web['domain_id'];
$backup_dir_is_ready = true; $backup_dir_is_ready = true;
//* mount backup directory, if necessary //* mount backup directory, if necessary
...@@ -178,7 +180,10 @@ class backup_plugin { ...@@ -178,7 +180,10 @@ class backup_plugin {
$app->uses('ini_parser,file,getconf'); $app->uses('ini_parser,file,getconf');
$server_config = $app->getconf->get_server_config($conf['server_id'], 'server'); $server_config = $app->getconf->get_server_config($conf['server_id'], 'server');
$backup_dir = $server_config['backup_dir']; $backup_dir = trim($server_config['backup_dir']);
if($backup_dir == '') return;
$backup_dir_is_ready = true; $backup_dir_is_ready = true;
//* mount backup directory, if necessary //* mount backup directory, if necessary
......
Markdown is supported
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