Skip to content

Commit cbccb0a

Browse files
authored
[Bug] Deleting backups doesn't work (Local, FTP) (hestiacp#1421)
* Issue as $BACKUP get overwritten by parse_object_kv_list * Fix issue with ftp removal
1 parent 2c9de42 commit cbccb0a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

bin/v-delete-user-backup

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,25 @@ is_object_valid 'backup' 'BACKUP' "$2"
3737
# Perform verification if read-only mode is enabled
3838
check_hestia_demo_mode
3939

40-
4140
#----------------------------------------------------------#
4241
# Action #
4342
#----------------------------------------------------------#
4443

44+
backup_folder=$BACKUP
45+
4546
line=$(grep "BACKUP='$backup'" $USER_DATA/backup.conf)
4647
parse_object_kv_list "$line"
4748

48-
49+
deleted=0
4950
if [[ "$TYPE" =~ "sftp" ]]; then
5051
sftp_delete "$backup"
52+
deleted=1
5153
fi
5254
if [[ "$TYPE" =~ "ftp" ]] && [ "$deleted" == "0" ]; then
53-
ftp_delete "backup"
55+
ftp_delete "$backup"
5456
fi
5557
if [[ "$TYPE" =~ "local" ]]; then
56-
rm -f $BACKUP/$2
58+
rm -f $backup_folder/$2
5759
fi
5860

5961
# Deleting backup

0 commit comments

Comments
 (0)