mirror of
https://github.com/myvesta/vesta
synced 2025-08-21 05:44:08 -07:00
v-move-domain-and-database-to-account: Update wordfence-waf.php
This commit is contained in:
parent
701a847afb
commit
846d8888cb
1 changed files with 32 additions and 12 deletions
|
@ -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 #
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue