From b0b3a9403f50252ac63bb0d888f66307cc95902e Mon Sep 17 00:00:00 2001 From: isscbta <53144593+isscbta@users.noreply.github.com> Date: Mon, 15 Jan 2024 17:08:52 +0100 Subject: [PATCH] Update Wordfence WAF Path --- bin/v-clone-website | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/bin/v-clone-website b/bin/v-clone-website index 46623db4..dfac1c25 100644 --- a/bin/v-clone-website +++ b/bin/v-clone-website @@ -431,6 +431,33 @@ else sudo -H -u$TO_USER wp config shuffle-salts fi +# ----------- Update Wordfence WAF Path ------------- + +# Path to .user.ini file +user_ini="$TO_USER/web/$TO_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/$FROM_USER/public_html|/home/$TO_USER/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 + echo "===== DONE ====" echo "You can visit http://$TO_DOMAIN/"