Update Wordfence WAF Path

This commit is contained in:
isscbta 2024-01-15 17:08:52 +01:00 committed by GitHub
parent 003f35810b
commit b0b3a9403f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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/"