mirror of
https://github.com/myvesta/vesta
synced 2025-08-14 10:37:42 -07:00
Create v-unlock-wordpress
This commit is contained in:
parent
efc2be9f71
commit
c9c29ce7a9
1 changed files with 67 additions and 0 deletions
67
bin/v-unlock-wordpress
Normal file
67
bin/v-unlock-wordpress
Normal file
|
@ -0,0 +1,67 @@
|
|||
#!/bin/bash
|
||||
# info: Unlock previously locked WordPress files if they were potentially infected (somewhere) by PHP malware, in order to stop further infection
|
||||
# options: DOMAIN
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Variable&Function #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
whoami=$(whoami)
|
||||
if [ "$whoami" != "root" ]; then
|
||||
echo "You must be root to execute this script"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Importing system environment
|
||||
source /etc/profile
|
||||
|
||||
# Includes
|
||||
source /usr/local/vesta/func/main.sh
|
||||
|
||||
# Argument definition
|
||||
domain=$1
|
||||
|
||||
user=$(/usr/local/vesta/bin/v-search-domain-owner $domain)
|
||||
if [ -z "$user" ]; then
|
||||
check_result $E_NOTEXIST "domain $domain doesn't exist"
|
||||
fi
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
check_args '1' "$#" 'DOMAIN'
|
||||
is_format_valid 'domain'
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
is_object_unsuspended 'user' 'USER' "$user"
|
||||
|
||||
if [ ! -d "/home/$user" ]; then
|
||||
echo "User doesn't exist";
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if [ ! -d "/home/$user/web/$domain/public_html" ]; then
|
||||
echo "Domain doesn't exist";
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
cd /home/$user/web/$domain/public_html
|
||||
|
||||
# lock files
|
||||
chown -R $user:$user public_html/
|
||||
|
||||
rm public_html/wp-content/uploads/.htaccess
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Vesta #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
echo "v-unlock-wordpress: Done."
|
||||
|
||||
log_event "$OK" "$ARGUMENTS"
|
||||
|
||||
exit
|
Loading…
Add table
Add a link
Reference in a new issue