Skip to content

Commit bc75da5

Browse files
Delete web files if they exist before restore.
1 parent 58a5698 commit bc75da5

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

bin/v-restore-user

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# info: restore user
33
# options: USER BACKUP [WEB] [DNS] [MAIL] [DB] [CRON] [UDIR] [NOTIFY]
44
#
5-
# The function for resotring user from backup.
5+
# The function for restoring user from backup.
66

77

88
#----------------------------------------------------------#
@@ -399,6 +399,8 @@ if [ "$web" != 'no' ] && [ ! -z "$WEB_SYSTEM" ]; then
399399
fi
400400

401401
# Restoring web domain data
402+
if [ -d "$HOMEDIR/$user/web/$domain/public_html" ]
403+
rm -rf $HOMEDIR/$user/web/$domain/public_html/*
402404
tar -xzpf $tmpdir/web/$domain/domain_data.tar.gz \
403405
-C $HOMEDIR/$user/web/$domain/
404406
if [ "$?" -ne 0 ]; then
@@ -409,10 +411,6 @@ if [ "$web" != 'no' ] && [ ! -z "$WEB_SYSTEM" ]; then
409411
check_result "$E_PARSING" "$error"
410412
fi
411413

412-
# Applying fix for tar < 1.24
413-
find $HOMEDIR/$user/web/$domain -type d \
414-
-exec chown -h $user:$user {} \;
415-
416414
# Re-chowning files if uid differs
417415
if [ "$old_uid" -ne "$new_uid" ]; then
418416
find $HOMEDIR/$user/web/$domain/ -user $old_uid \

0 commit comments

Comments
 (0)