From a85aa52b22de458feace14205f4a682362eb5a58 Mon Sep 17 00:00:00 2001 From: Serghey Rodin Date: Tue, 8 Apr 2014 23:39:19 +0300 Subject: [PATCH] delete backup exclusions --- bin/v-delete-user-backup-exclusions | 77 +++++++++++++++++++ web/bulk/backup/exclusions/index.php | 23 ++++++ web/delete/backup/exclusion/index.php | 27 +++++++ web/inc/i18n/en.php | 1 + .../admin/list_backup_exclusions.html | 8 +- 5 files changed, 132 insertions(+), 4 deletions(-) create mode 100755 bin/v-delete-user-backup-exclusions create mode 100644 web/bulk/backup/exclusions/index.php create mode 100644 web/delete/backup/exclusion/index.php diff --git a/bin/v-delete-user-backup-exclusions b/bin/v-delete-user-backup-exclusions new file mode 100755 index 000000000..40f0ec7ca --- /dev/null +++ b/bin/v-delete-user-backup-exclusions @@ -0,0 +1,77 @@ +#!/bin/bash +# info: delete backup exclusion +# options: USER [SYSTEM] +# +# The function for deleteing backup exclusion + + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user=$1 +system=$(echo $2 | tr '[:lower:]' '[:upper:]') + +# Includes +source $VESTA/func/main.sh +source $VESTA/conf/vesta.conf + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +check_args '1' "$#" 'USER [SYSTEM]' +validate_format 'user' +is_object_valid 'user' 'USER' "$user" + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Delete system exclusion +if [ -z "$system" ]; then + WEB='' + DNS='' + MAIL='' + DB='' + CRON='' + USER='' +else + touch $USER_DATA/backup-excludes.conf + source $USER_DATA/backup-excludes.conf + case $system in + WEB) WEB='';; + DNS) DNS='';; + MAIL) MAIL='';; + DB) DB='';; + CRON) CRON='';; + USER) USER='';; + esac +fi + +# Updating exlusion list +echo "WEB='$WEB'" > $USER_DATA/backup-excludes.conf +echo "DNS='$DNS'" >> $USER_DATA/backup-excludes.conf +echo "MAIL='$MAIL'" >> $USER_DATA/backup-excludes.conf +echo "DB='$DB'" >> $USER_DATA/backup-excludes.conf +echo "CRON='$DB'" >> $USER_DATA/backup-excludes.conf +echo "USER='$USER'" >> $USER_DATA/backup-excludes.conf +chmod 660 $USER_DATA/backup-excludes.conf + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +if [ -z "$system" ]; then + log_history "deleted all exlusions" +else + log_history "deleted $system exlusion" +fi +log_event "$OK" "$EVENT" + +exit diff --git a/web/bulk/backup/exclusions/index.php b/web/bulk/backup/exclusions/index.php new file mode 100644 index 000000000..4d0e43933 --- /dev/null +++ b/web/bulk/backup/exclusions/index.php @@ -0,0 +1,23 @@ + 'Are you sure to suspend cron job?', 'UNSUSPEND_CRON_CONFIRMATION' => 'Are you sure to unsuspend cron job?', 'DELETE_BACKUP_CONFIRMATION' => 'Are you sure to delete %s backup?', + 'DELETE_EXCLUSION_CONFIRMATION' => 'Are you sure to delete %s exclusion?', 'DELETE_PACKAGE_CONFIRMATION' => 'Are you sure to delete package %s?', 'DELETE_IP_CONFIRMATION' => 'Are you sure to delere IP address %s?', 'Welcome' => 'Welcome', diff --git a/web/templates/admin/list_backup_exclusions.html b/web/templates/admin/list_backup_exclusions.html index bdb1ecdb5..a0da3ce53 100644 --- a/web/templates/admin/list_backup_exclusions.html +++ b/web/templates/admin/list_backup_exclusions.html @@ -11,7 +11,7 @@