diff --git a/install/sql/incremental/upd_0061.sql b/install/sql/incremental/upd_0061.sql new file mode 100644 index 0000000000000000000000000000000000000000..781b2212260566c06db703f8c83aab0b1bd309a3 --- /dev/null +++ b/install/sql/incremental/upd_0061.sql @@ -0,0 +1 @@ +ALTER TABLE `web_domain` ADD `backup_excludes` MEDIUMTEXT NULL AFTER `backup_copies` ; \ No newline at end of file diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql index 09a8607c61f2ff98823eba03fe3aaa3f3496695d..0556ff660f1b3365cbb16cc5047ebea444455ddf 100644 --- a/install/sql/ispconfig3.sql +++ b/install/sql/ispconfig3.sql @@ -1796,6 +1796,7 @@ CREATE TABLE `web_domain` ( `custom_php_ini` mediumtext, `backup_interval` VARCHAR( 255 ) NOT NULL DEFAULT 'none', `backup_copies` INT NOT NULL DEFAULT '1', + `backup_excludes` mediumtext, `active` enum('n','y') NOT NULL default 'y', `traffic_quota_lock` enum('n','y') NOT NULL default 'n', `fastcgi_php_version` varchar(255) DEFAULT NULL, diff --git a/interface/web/sites/form/web_domain.tform.php b/interface/web/sites/form/web_domain.tform.php index 59ecba44058694b2630fa240e64ecb5b395c15fd..ed590c9813708f0026f7f984de3a447a536caa7d 100644 --- a/interface/web/sites/form/web_domain.tform.php +++ b/interface/web/sites/form/web_domain.tform.php @@ -520,6 +520,18 @@ $form["tabs"]['backup'] = array ( 'default' => '', 'value' => array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10') ), + 'backup_excludes' => array ( + 'datatype' => 'VARCHAR', + 'validators' => array ( 0 => array ( 'type' => 'REGEX', + 'regex' => '@^(?!.*\.\.)[-a-zA-Z0-9_/.~,]*$@', + 'errmsg'=> 'backup_excludes_error_regex'), + ), + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), //################################# // ENDE Datatable fields //################################# diff --git a/interface/web/sites/form/web_vhost_subdomain.tform.php b/interface/web/sites/form/web_vhost_subdomain.tform.php index 5e507d12f43e27d0e35e3dd6cad7a14658fb6e7b..328fc270e48a5414ce361bd4345c6f10f7ffeba7 100644 --- a/interface/web/sites/form/web_vhost_subdomain.tform.php +++ b/interface/web/sites/form/web_vhost_subdomain.tform.php @@ -510,6 +510,18 @@ $form["tabs"]['backup'] = array ( 'default' => '', 'value' => array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10') ), + 'backup_excludes' => array ( + 'datatype' => 'VARCHAR', + 'validators' => array ( 0 => array ( 'type' => 'REGEX', + 'regex' => '@^(?!.*\.\.)[-a-zA-Z0-9_/.~,]*$@', + 'errmsg'=> 'backup_excludes_error_regex'), + ), + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), //################################# // ENDE Datatable fields //################################# diff --git a/interface/web/sites/lib/lang/de_web_domain.lng b/interface/web/sites/lib/lang/de_web_domain.lng index 899a34dd3dcb2697856e195edd166030ab597d46..4a6dc0c8018d431f101f2661b5561a81530a150b 100644 --- a/interface/web/sites/lib/lang/de_web_domain.lng +++ b/interface/web/sites/lib/lang/de_web_domain.lng @@ -121,4 +121,9 @@ $wb['invalid_rewrite_rules_txt'] = 'Unzulässige Rewrite Rules'; $wb['allowed_rewrite_rule_directives_txt'] = 'Erlaubte Direktiven:'; $wb['configuration_error_txt'] = 'KONFIGURATIONSFEHLER'; $wb['variables_txt'] = 'Variablen'; +$wb['added_by_txt'] = 'Hinzugefügt von'; +$wb['added_date_txt'] = 'Hinzugefügt am'; +$wb['backup_excludes_txt'] = 'Auszuschließende Verzeichnisse'; +$wb['backup_excludes_note_txt'] = '(Mehrere Verzeichnisse mit Kommas trennen)'; +$wb['backup_excludes_error_regex'] = 'Die auszuschließenden Verzeichnisse enthalten ungültige Zeichen.'; ?> \ No newline at end of file diff --git a/interface/web/sites/lib/lang/de_web_vhost_subdomain.lng b/interface/web/sites/lib/lang/de_web_vhost_subdomain.lng index 827cc807ac91c19174e24ef2776185eaf280cdab..f454aa42997ae89db1111a53a11b618b8fc8e286 100644 --- a/interface/web/sites/lib/lang/de_web_vhost_subdomain.lng +++ b/interface/web/sites/lib/lang/de_web_vhost_subdomain.lng @@ -119,4 +119,8 @@ $wb['rewrite_rules_txt'] = 'Rewrite Rules'; $wb['invalid_rewrite_rules_txt'] = 'Unzulässige Rewrite Rules'; $wb['allowed_rewrite_rule_directives_txt'] = 'Erlaubte Direktiven:'; $wb['configuration_error_txt'] = 'KONFIGURATIONSFEHLER'; +$wb['variables_txt'] = 'Variablen'; +$wb['backup_excludes_txt'] = 'Auszuschließende Verzeichnisse'; +$wb['backup_excludes_note_txt'] = '(Mehrere Verzeichnisse mit Kommas trennen)'; +$wb['backup_excludes_error_regex'] = 'Die auszuschließenden Verzeichnisse enthalten ungültige Zeichen.'; ?> \ No newline at end of file diff --git a/interface/web/sites/lib/lang/en_web_domain.lng b/interface/web/sites/lib/lang/en_web_domain.lng index b35236ce7242776c3637333763a76f46ab77517d..415bebd99f2b77fc5e4e0e595eb8eb74b970f5ac 100644 --- a/interface/web/sites/lib/lang/en_web_domain.lng +++ b/interface/web/sites/lib/lang/en_web_domain.lng @@ -123,4 +123,7 @@ $wb['configuration_error_txt'] = "CONFIGURATION ERROR"; $wb['variables_txt'] = 'Variables'; $wb['added_by_txt'] = 'Added by'; $wb['added_date_txt'] = 'Added date'; +$wb['backup_excludes_txt'] = 'Excluded Directories'; +$wb['backup_excludes_note_txt'] = '(Separate multiple directories with commas)'; +$wb['backup_excludes_error_regex'] = 'The excluded directories contain invalid characters.'; ?> \ No newline at end of file diff --git a/interface/web/sites/lib/lang/en_web_vhost_subdomain.lng b/interface/web/sites/lib/lang/en_web_vhost_subdomain.lng index ae8873813e14ceb1839059600205fdeec857ad74..96e16f4000dc535d95be5e459aadaa59578dc39f 100644 --- a/interface/web/sites/lib/lang/en_web_vhost_subdomain.lng +++ b/interface/web/sites/lib/lang/en_web_vhost_subdomain.lng @@ -120,4 +120,8 @@ $wb['rewrite_rules_txt'] = 'Rewrite Rules'; $wb['invalid_rewrite_rules_txt'] = 'Invalid Rewrite Rules'; $wb['allowed_rewrite_rule_directives_txt'] = 'Allowed Directives:'; $wb['configuration_error_txt'] = "CONFIGURATION ERROR"; +$wb['variables_txt'] = 'Variables'; +$wb['backup_excludes_txt'] = 'Auszuschließende Verzeichnisse'; +$wb['backup_excludes_note_txt'] = '(Mehrere Verzeichnisse mit Kommas trennen)'; +$wb['backup_excludes_error_regex'] = 'Die auszuschließenden Verzeichnisse enthalten ungültige Zeichen.'; ?> \ No newline at end of file diff --git a/interface/web/sites/templates/web_domain_backup.htm b/interface/web/sites/templates/web_domain_backup.htm index cfe43379f5239f431b6dc508d1dfa7fb52d6e538..e5829e5a6f5360ff233db49f0edd1bff87d7d85c 100644 --- a/interface/web/sites/templates/web_domain_backup.htm +++ b/interface/web/sites/templates/web_domain_backup.htm @@ -25,6 +25,10 @@ + +
+ +  {tmpl_var name='backup_excludes_note_txt'}
diff --git a/interface/web/sites/templates/web_vhost_subdomain_advanced.htm b/interface/web/sites/templates/web_vhost_subdomain_advanced.htm index cffd3fa37ee17e4d7c8502b9776f5056b6c5965a..52fb5c774dc6bebb951b03f8abb6c42153a3edc4 100644 --- a/interface/web/sites/templates/web_vhost_subdomain_advanced.htm +++ b/interface/web/sites/templates/web_vhost_subdomain_advanced.htm @@ -75,7 +75,7 @@
-  {tmpl_var name="available_nginx_directive_snippets_txt"}

 {tmpl_var name="nginx_directive_snippets_txt"} +  {tmpl_var name="available_nginx_directive_snippets_txt"}

 {tmpl_var name="nginx_directive_snippets_txt"}
----
 {tmpl_var name='variables_txt'}: {DOCROOT}, {FASTCGIPASS}
diff --git a/interface/web/sites/templates/web_vhost_subdomain_backup.htm b/interface/web/sites/templates/web_vhost_subdomain_backup.htm index 6c55e50a53dc6daa2cda95007a220d56feaf12fc..d76afdf685abf4e28f916713f647cc179c6c7ff3 100644 --- a/interface/web/sites/templates/web_vhost_subdomain_backup.htm +++ b/interface/web/sites/templates/web_vhost_subdomain_backup.htm @@ -16,6 +16,10 @@ +
+
+ +  {tmpl_var name='backup_excludes_note_txt'}
diff --git a/server/cron_daily.php b/server/cron_daily.php index 60f3c219676693aa6532ed5b70be2a83b2acc4a7..cb9058223aa4bb4254d6239359c22e1038564331 100644 --- a/server/cron_daily.php +++ b/server/cron_daily.php @@ -1127,15 +1127,27 @@ if($backup_dir != '') { chown($web_backup_dir, 'root'); chgrp($web_backup_dir, 'root'); }*/ + + $backup_excludes = ''; + $b_excludes = explode(',', trim($rec['backup_excludes'])); + if(is_array($b_excludes) && !empty($b_excludes)){ + foreach($b_excludes as $b_exclude){ + $b_exclude = trim($b_exclude); + if($b_exclude != ''){ + $backup_excludes .= ' --exclude='.escapeshellarg($b_exclude); + } + } + } + if($backup_mode == 'userzip') { //* Create a .zip backup as web user and include also files owned by apache / nginx user $web_backup_file = 'web'.$web_id.'_'.date('Y-m-d_H-i').'.zip'; exec('cd '.escapeshellarg($web_path).' && sudo -u '.escapeshellarg($web_user).' find . -group '.escapeshellarg($web_group).' -print 2> /dev/null | zip -b /tmp --exclude=backup\* --symlinks '.escapeshellarg($web_backup_dir.'/'.$web_backup_file).' -@', $tmp_output, $retval); - if($retval == 0) exec('cd '.escapeshellarg($web_path).' && sudo -u '.escapeshellarg($web_user).' find . -user '.escapeshellarg($http_server_user).' -print 2> /dev/null | zip -b /tmp --exclude=backup\* --update --symlinks '.escapeshellarg($web_backup_dir.'/'.$web_backup_file).' -@', $tmp_output, $retval); + if($retval == 0) exec('cd '.escapeshellarg($web_path).' && sudo -u '.escapeshellarg($web_user).' find . -user '.escapeshellarg($http_server_user).' -print 2> /dev/null | zip -b /tmp --exclude=backup\*'.$backup_excludes.' --update --symlinks '.escapeshellarg($web_backup_dir.'/'.$web_backup_file).' -@', $tmp_output, $retval); } else { //* Create a tar.gz backup as root user $web_backup_file = 'web'.$web_id.'_'.date('Y-m-d_H-i').'.tar.gz'; - exec('tar pczf '.escapeshellarg($web_backup_dir.'/'.$web_backup_file).' --exclude=backup\* --directory '.escapeshellarg($web_path).' .', $tmp_output, $retval); + exec('tar pczf '.escapeshellarg($web_backup_dir.'/'.$web_backup_file).' --exclude=backup\*'.$backup_excludes.' --directory '.escapeshellarg($web_path).' .', $tmp_output, $retval); } if($retval == 0 || $backup_mode != 'userzip'){ // tar can return 1 (due to harmless warings) and still create valid backups if(is_file($web_backup_dir.'/'.$web_backup_file)){