Update Wordfence WAF Path

This commit is contained in:
isscbta 2023-12-28 16:01:09 +01:00 committed by GitHub
parent 328f6f293c
commit 91f6ae080a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -88,6 +88,40 @@ if [ $? -ne 0 ]; then
RET=$E_NOTEXIST
fi
#----------------------------------------------------------#
# Update Wordfence WAF Path #
#----------------------------------------------------------#
# Path to .user.ini file
user_ini="$USER_DATA/web/$domain/public_html/.user.ini"
# Check if .user.ini exists
if [ -f "$user_ini" ]; then
echo "Updating .user.ini with new user path..."
# Temporary file for modification
tmp_file=$(mktemp)
# Change path from old USER to new USER_TO
sed "s|/home/$owner/public_html|/home/$USER_TO/public_html|g" "$user_ini" > "$tmp_file"
# Check if replacement was successful and update .user.ini
if [ $? -eq 0 ]; then
mv "$tmp_file" "$user_ini"
echo ".user.ini updated successfully."
else
echo "Failed to update .user.ini file."
rm "$tmp_file" # Deletes temporary file
fi
else
echo ".user.ini does not exist, no changes made."
fi
#----------------------------------------------------------#
# Exit #
#----------------------------------------------------------#
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#