v-move-domain-and-database-to-account: Update wordfence-waf.php

This commit is contained in:
myvesta 2025-05-14 14:50:22 +02:00 committed by GitHub
commit 846d8888cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -92,31 +92,51 @@ fi
# Update Wordfence WAF Path # # Update Wordfence WAF Path #
#----------------------------------------------------------# #----------------------------------------------------------#
# Path to .user.ini file filepath="$USER_DATA/web/$domain/public_html/.user.ini"
user_ini="$USER_DATA/web/$domain/public_html/.user.ini" filename=$(basename $filepath)
# Check if .user.ini exists # Check if file exists
if [ -f "$user_ini" ]; then if [ -f "$filepath" ]; then
echo "Updating .user.ini with new user path..." echo "Updating $filename with new user path..."
# Temporary file for modification # Temporary file for modification
tmp_file=$(mktemp) tmp_file=$(mktemp)
# Change path from old USER to new USER_TO # 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" sed "s|/home/$owner/public_html|/home/$USER_TO/public_html|g" "$filepath" > "$tmp_file"
# Check if replacement was successful and update .user.ini # Check if replacement was successful and update file
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
mv "$tmp_file" "$user_ini" mv "$tmp_file" "$filepath"
echo ".user.ini updated successfully." echo "$filename updated successfully."
else else
echo "Failed to update .user.ini file." echo "Failed to update $filename file."
rm "$tmp_file" # Deletes temporary file rm "$tmp_file" # Deletes temporary file
fi fi
else
echo ".user.ini does not exist, no changes made."
fi fi
filepath="$USER_DATA/web/$domain/public_html/wordfence-waf.php"
filename=$(basename $filepath)
# Check if file exists
if [ -f "$filepath" ]; then
echo "Updating $filename 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" "$filepath" > "$tmp_file"
# Check if replacement was successful and update file
if [ $? -eq 0 ]; then
mv "$tmp_file" "$filepath"
echo "$filename updated successfully."
else
echo "Failed to update $filename file."
rm "$tmp_file" # Deletes temporary file
fi
fi
#----------------------------------------------------------# #----------------------------------------------------------#
# Vesta # # Vesta #