mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-21 05:44:07 -07:00
Script to determine which PHP version a given domain is using
This commit is contained in:
parent
1c33f9cfd2
commit
d940389c15
1 changed files with 69 additions and 0 deletions
69
bin/v-get-php-version-of-domain.sh
Normal file
69
bin/v-get-php-version-of-domain.sh
Normal file
|
@ -0,0 +1,69 @@
|
|||
#!/bin/bash
|
||||
# info: Check PHP version used for certain domain
|
||||
# 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
|
||||
|
||||
# Argument definition
|
||||
domain=$1
|
||||
|
||||
user=$(/usr/local/vesta/bin/v-search-domain-owner $domain)
|
||||
USER=$user
|
||||
|
||||
# Includes
|
||||
source /usr/local/vesta/func/main.sh
|
||||
source /usr/local/vesta/func/domain.sh
|
||||
|
||||
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 #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
|
||||
TPL=$(/usr/local/vesta/bin/v-list-web-domain $user $domain shell | grep 'TEMPLATE:' | awk '{print $2}')
|
||||
if [[ $TPL == "PHP-FPM-"* ]]; then
|
||||
fpm_tpl_ver=${TPL:8:2}
|
||||
fpm_ver="${TPL:8:1}.${TPL:9:1}"
|
||||
fi
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Vesta #
|
||||
#----------------------------------------------------------#
|
||||
echo "PHP-FPM version running on given domain is: $fpm_ver"
|
||||
|
||||
exit
|
Loading…
Add table
Add a link
Reference in a new issue