mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-14 10:37:39 -07:00
delete backup exclusions
This commit is contained in:
parent
5edb660eb9
commit
a85aa52b22
5 changed files with 132 additions and 4 deletions
77
bin/v-delete-user-backup-exclusions
Executable file
77
bin/v-delete-user-backup-exclusions
Executable file
|
@ -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
|
23
web/bulk/backup/exclusions/index.php
Normal file
23
web/bulk/backup/exclusions/index.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
// Init
|
||||
error_reporting(NULL);
|
||||
ob_start();
|
||||
session_start();
|
||||
|
||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||
|
||||
$backup = $_POST['system'];
|
||||
$action = $_POST['action'];
|
||||
|
||||
switch ($action) {
|
||||
case 'delete': $cmd='v-delete-user-backup-exclusions';
|
||||
break;
|
||||
default: header("Location: /list/backup/exclusions"); exit;
|
||||
}
|
||||
|
||||
foreach ($backup as $value) {
|
||||
$value = escapeshellarg($value);
|
||||
exec (VESTA_CMD.$cmd." ".$user." ".$value, $output, $return_var);
|
||||
}
|
||||
|
||||
header("Location: /list/backup/exclusions");
|
27
web/delete/backup/exclusion/index.php
Normal file
27
web/delete/backup/exclusion/index.php
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
// Init
|
||||
error_reporting(NULL);
|
||||
ob_start();
|
||||
session_start();
|
||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||
|
||||
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
|
||||
$user=$_GET['user'];
|
||||
}
|
||||
|
||||
if (!empty($_GET['system'])) {
|
||||
$v_username = escapeshellarg($user);
|
||||
$v_system = escapeshellarg($_GET['system']);
|
||||
exec (VESTA_CMD."v-delete-user-backup-exclusions ".$v_username." ".$v_system, $output, $return_var);
|
||||
}
|
||||
check_return_code($return_var,$output);
|
||||
unset($output);
|
||||
|
||||
$back = $_SESSION['back'];
|
||||
if (!empty($back)) {
|
||||
header("Location: ".$back);
|
||||
exit;
|
||||
}
|
||||
|
||||
header("Location: /list/backup/exclusions/");
|
||||
exit;
|
|
@ -382,6 +382,7 @@ $LANG['en'] = array(
|
|||
'SUSPEND_CRON_CONFIRMATION' => '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',
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
</form>
|
||||
</div>
|
||||
<div class="submenu-select-block">
|
||||
<form action="/bulk/backup/" method="post" id="objects">
|
||||
<form action="/bulk/backup/exclusions/" method="post" id="objects">
|
||||
<a class="submenu-select-link" href='javascript:checkedAll("objects");'> <?php print __('toggle all');?> </a>
|
||||
<select class="submenu-select-dropdown" name="action">
|
||||
<option value=""><?php print __('apply to selected');?></option>
|
||||
|
@ -35,7 +35,7 @@
|
|||
<tr class="data-row">
|
||||
<td class="data-dotted">
|
||||
<table class="data-col1">
|
||||
<tr><td><input type="checkbox" class="ch-toggle" name="exclusion[]" value="<?php echo $key ?>" ></td></tr>
|
||||
<tr><td><input type="checkbox" class="ch-toggle" name="system[]" value="<?php echo $key ?>" ></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="data-dotted" width="830px">
|
||||
|
@ -43,9 +43,9 @@
|
|||
<span class="do_delete">
|
||||
<img src="/images/delete.png" width="7px" height="7px">
|
||||
<?php print __('delete');?>
|
||||
<input type="hidden" name="delete_url" value="/delete/backup/exclusion/?excl=<?php echo "$key" ?>" />
|
||||
<input type="hidden" name="delete_url" value="/delete/backup/exclusion/?system=<?php echo "$key" ?>" />
|
||||
<div id="delete_dialog_<?php echo $i ?>" class="confirmation-text-delete hidden" title="<?php print __('Confirmation');?>">
|
||||
<p class="counter-value"><?php print __('DELETE_BACKUP_CONFIRMATION',$key);?></p>
|
||||
<p class="counter-value"><?php print __('DELETE_EXCLUSION_CONFIRMATION',$key);?></p>
|
||||
</div>
|
||||
</span>
|
||||
</a>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue