mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-19 21:04:06 -07:00
backup pages
This commit is contained in:
parent
b0d5764cae
commit
7a99bd4ad0
7 changed files with 153 additions and 4 deletions
|
@ -390,6 +390,9 @@ local_backup(){
|
|||
chown nginx:$user $BACKUP/$user.$DATE.tar
|
||||
localbackup='yes'
|
||||
echo
|
||||
|
||||
U_BACKUPS=$(ls $BACKUP/|grep "^$user."|wc -l)
|
||||
update_user_value "$user" '$U_BACKUPS' "$U_BACKUPS"
|
||||
}
|
||||
|
||||
|
||||
|
|
53
bin/v_delete_user_backup
Executable file
53
bin/v_delete_user_backup
Executable file
|
@ -0,0 +1,53 @@
|
|||
#!/bin/bash
|
||||
# info: delete user backup
|
||||
# options: user nackup
|
||||
#
|
||||
# The function deletes user backup.
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Variable&Function #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Argument defenition
|
||||
user=$1
|
||||
backup=$(echo $2| cut -f 2 -d \.)
|
||||
|
||||
# Includes
|
||||
source $VESTA/conf/vesta.conf
|
||||
source $VESTA/func/main.sh
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
check_args '2' "$#" 'user backup'
|
||||
validate_format 'user' 'backup'
|
||||
is_system_enabled "$BACKUP_SYSTEM"
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
is_object_unsuspended 'user' 'USER' "$user"
|
||||
is_object_valid 'backup' 'BACKUP' "$2"
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Deleting backup
|
||||
rm -f $BACKUP/$2
|
||||
sed -i "/BACKUP='$2' /d" $USER_DATA/backup.conf
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Vesta #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Update counter
|
||||
U_BACKUPS=$(ls $BACKUP/|grep "^$user."|wc -l)
|
||||
update_user_value "$user" '$U_BACKUPS' "$U_BACKUPS"
|
||||
|
||||
# Logging
|
||||
log_history "$EVENT"
|
||||
log_event "$OK" "$EVENT"
|
||||
|
||||
exit
|
|
@ -13,6 +13,8 @@ A8=$8
|
|||
A9=$9
|
||||
EVENT="DATE='$DATE' TIME='$TIME' CMD='$SCRIPT' A1='$A1' A2='$A2' A3='$A3'"
|
||||
EVENT="$EVENT A4='$A4' A5='$A5' A6='$A6' A7='$A7' A8='$A8' A9='$A9'"
|
||||
HOMEDIR='/home'
|
||||
BACKUP='/backup'
|
||||
BACKUP_GZIP=5
|
||||
BACKUP_DISK_LIMIT=95
|
||||
BACKUP_LA_LIMIT=5
|
||||
|
|
17
web/delete/backup/index.php
Normal file
17
web/delete/backup/index.php
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
// Init
|
||||
error_reporting(NULL);
|
||||
ob_start();
|
||||
session_start();
|
||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||
|
||||
if ($_SESSION['user'] == 'admin') {
|
||||
if (!empty($_GET['backup'])) {
|
||||
$v_username = escapeshellarg($user);
|
||||
$v_backup = escapeshellarg($_GET['backup']);
|
||||
exec (VESTA_CMD."v_delete_user_backup ".$v_username." ".$v_backup, $output, $return_var);
|
||||
unset($output);
|
||||
}
|
||||
}
|
||||
|
||||
header("Location: /list/backup/");
|
23
web/download/backup/index.php
Normal file
23
web/download/backup/index.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
// Init
|
||||
error_reporting(NULL);
|
||||
session_start();
|
||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||
$backup = $_GET['backup'];
|
||||
|
||||
// Data
|
||||
if ($_SESSION['user'] == 'admin') {
|
||||
header('Content-type: application/gzip');
|
||||
header("Content-Disposition: attachment; filename=\"".$backup."\";" );
|
||||
header("X-Accel-Redirect: /backup/" . $backup);
|
||||
}
|
||||
|
||||
if ((!empty($_SESSION['user'])) && ($_SESSION['user'] != 'admin')) {
|
||||
if (preg_match("/^".$user."/i", $backup)) {
|
||||
header('Content-type: application/gzip');
|
||||
header("Content-Disposition: attachment; filename=\"".$backup."\";" );
|
||||
header("X-Accel-Redirect: /backup/" . $backup);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -13,7 +13,46 @@ foreach ($data as $key => $value) {
|
|||
if (!empty($data[$key]['MAIL'])) $mail = 'yes ¨';
|
||||
if (!empty($data[$key]['DB'])) $db = 'yes ¨';
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$('#restore_dialog_<?php echo "$i" ?>').dialog({
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
width: 360,
|
||||
buttons: {
|
||||
"Ok": function(event, ui) {
|
||||
$(this).dialog("close");
|
||||
},
|
||||
"Cancel": function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
$('#restore_link_<?php echo "$i" ?>').click(function(){
|
||||
$('#restore_dialog_<?php echo "$i" ?>').dialog('open');
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#delete_dialog_<?php echo "$i" ?>').dialog({
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
width: 360,
|
||||
buttons: {
|
||||
"Ok": function(event, ui) {
|
||||
location.href = '/delete/backup/?backup=<?php echo "$key" ?>';
|
||||
},
|
||||
"Cancel": function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
$('#delete_link_<?php echo "$i" ?>').click(function(){
|
||||
$('#delete_dialog_<?php echo "$i" ?>').dialog('open');
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
<tr class="data-row">
|
||||
<td class="data-dotted" style="padding: 0px 10px 0px 0px" width="150">
|
||||
<table class="data-col1">
|
||||
|
@ -25,9 +64,21 @@ foreach ($data as $key => $value) {
|
|||
<td class="data-dotted" width="830px" style="vertical-align:top;">
|
||||
<table width="830px"><tr>
|
||||
<td></td>
|
||||
<td class="data-controls" width="80px"><img src="/images/download.png" width="8px" height="8px"><a href="#"> download</a></td>
|
||||
<td class="data-controls" width="70px"><img src="/images/restore.png" width="6px" height="8px"><a href="#"> restore</a></td>
|
||||
<td class="data-controls" width="70px"><img src="/images/delete.png" width="7px" height="7px"><a href="#"> delete</a></td>
|
||||
<td class="data-controls" width="80px"><img src="/images/download.png" width="8px" height="8px"><a href="/download/backup/?backup=<?php echo $key ?>" target="_blank"> download</a></td>
|
||||
<td class="data-controls" width="80px">
|
||||
<img src="/images/restore.png" width="6px" height="8px">
|
||||
<a href="#" id="restore_link_<?php echo "$i"?>"> restore</a>
|
||||
<div id="restore_dialog_<?php echo "$i" ?>" title="Confirmation">
|
||||
<p class="counter-value">Are you sure you want to restore <b><?php echo "$key" ?></b> backup?</p>
|
||||
</div>
|
||||
</td>
|
||||
<td class="data-controls" width="70px">
|
||||
<img src="/images/delete.png" width="7px" height="7px">
|
||||
<a href="#" id="delete_link_<?php echo $i ?>"> delete</a>
|
||||
<div id="delete_dialog_<?php echo $i ?>" title="Confirmation">
|
||||
<p class="counter-value">Are you sure you want to delete <b><?php echo "$key" ?></b> backup?</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr></table>
|
||||
|
||||
<table class="data-col2" width="830px">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<table class="sub-menu">
|
||||
<tr>
|
||||
<td width="142px" style="padding: 16px 0 16px 6px">
|
||||
<button style="width:120px; padding: 2px 0px 2px 0px;" onclick="location.href='/add/backup/'">Add Backup</button>
|
||||
<button style="width:120px; padding: 2px 0px 2px 0px;" onclick="location.href='#'"> Backup Now</button>
|
||||
<td><a style="padding: 0 4px 0 12px" class="select-controls" href='javascript:checkedAll("vstobjects");'> toggle all </a>
|
||||
<select style="margin:0 0 0 0px">
|
||||
<option>apply to selected</option>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue