add snippet 'get-cloud-instance-to-update'..
This commit is contained in:
@ -226,33 +226,9 @@ echo "Create missing indices"
|
||||
echo -e "\033[32m-----\033[m"
|
||||
|
||||
|
||||
WEBSITE=
|
||||
_OK=false
|
||||
echo ""
|
||||
echo "Which site would you like to update?"
|
||||
echo ""
|
||||
declare -i i=0
|
||||
for _site in ${website_arr[@]} ; do
|
||||
IFS=':' read -a _arr <<< ${_site}
|
||||
echo " [$i] ${_arr[0]}"
|
||||
((i++))
|
||||
done
|
||||
echo
|
||||
echononl " Eingabe: "
|
||||
while ! $_OK ; do
|
||||
read _IN
|
||||
if is_number "$_IN" && [[ -n ${website_arr[$_IN]} ]]; then
|
||||
IFS=':' read -a _arr <<< ${website_arr[$_IN]}
|
||||
conf_file=${_arr[1]}
|
||||
DEFAULT_WEBSITE="${_arr[0]}"
|
||||
_OK=true
|
||||
else
|
||||
echo ""
|
||||
echo -e "\tFalsche Eingabe !"
|
||||
echo ""
|
||||
echononl " Eingabe: "
|
||||
fi
|
||||
done
|
||||
# Which cloud instance (website) would you like to update
|
||||
#
|
||||
source ${snippet_dir}/get-cloud-instance-to-update
|
||||
|
||||
|
||||
# - Reset IFS
|
||||
@ -420,81 +396,7 @@ fi
|
||||
|
||||
# Check PHP Version
|
||||
#
|
||||
if [[ "$PHP_ENGINE" = "FPM" ]] ; then
|
||||
if [[ -z "$PHP_VERSION" ]] ; then
|
||||
if [[ -z "$VHOST_CONFIG_FILE" ]] ; then
|
||||
if $NGINX_IS_ENABLED ; then
|
||||
|
||||
if [[ -f "/etc/nginx/sites-enabled/${WEBSITE}.conf" ]] ; then
|
||||
VHOST_CONFIG_FILE="$(realpath "/etc/nginx/sites-enabled/${WEBSITE}.conf")"
|
||||
fi
|
||||
|
||||
elif $APACHE2_IS_ENABLED ; then
|
||||
|
||||
if [[ -f "/usr/local/apache2/conf/vhosts/${WEBSITE}.conf.php-fpm" ]] ; then
|
||||
VHOST_CONFIG_FILE="/usr/local/apache2/conf/vhosts/${WEBSITE}.conf.php-fpm"
|
||||
elif [[ -f "/usr/local/apache2/conf/vhosts/${WEBSITE}.conf" ]] ; then
|
||||
VHOST_CONFIG_FILE="/usr/local/apache2/conf/vhosts/${WEBSITE}.conf"
|
||||
elif [[ -f "/etc/apache2/sites-enabled/${WEBSITE}.conf" ]] ; then
|
||||
VHOST_CONFIG_FILE="/etc/apache2/sites-enabled/${WEBSITE}.conf"
|
||||
fi
|
||||
|
||||
fi
|
||||
fi
|
||||
if [[ -n "$VHOST_CONFIG_FILE" ]] ; then
|
||||
PHP_VERSION="$(grep -o -E "^[^#]*php-?[[:digit:]]{1,2}\.[[:digit:]]{1}-fpm" $VHOST_CONFIG_FILE \
|
||||
| grep -o -E "[[:digit:]]{1,2}\.[[:digit:]]{1}")"
|
||||
fi
|
||||
if [[ -z "$PHP_VERSION" ]] ; then
|
||||
|
||||
if $NGINX_IS_ENABLED ; then
|
||||
upstream_handler="$(grep -o -E "^[^#]*fastcgi_pass\s+[^;]+" ${VHOST_CONFIG_FILE} | awk '{print$2}' )"
|
||||
for _file in $(ls /etc/nginx/conf.d/) ; do
|
||||
_rp_file="$(realpath "/etc/nginx/conf.d/${_file}")"
|
||||
if $(grep -q -E "\s+${upstream_handler}\s*" ${_rp_file} 2> /dev/null) ; then
|
||||
PHP_VERSION="$(grep -o -E "^[^#]*php-?[[:digit:]]{1,2}\.[[:digit:]]{1}-fpm" ${_rp_file} \
|
||||
| grep -o -E "[[:digit:]]{1,2}\.[[:digit:]]{1}")"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ -z "$PHP_VERSION" ]] ; then
|
||||
|
||||
warn "Cannot determin the PHP version\! Enter it manually"
|
||||
|
||||
main_version_regex="^[[:digit:]]{1,2}\.[[:digit:]]{1}$"
|
||||
|
||||
echo ""
|
||||
echo -e "\033[32m--\033[m"
|
||||
echo ""
|
||||
echo "Enter the PHP main version, e.g. 7.4 or 8.2 .."
|
||||
echo ""
|
||||
echo ""
|
||||
PHP_VERSION=
|
||||
while [ "X$PHP_VERSION" = "X" ]
|
||||
do
|
||||
echononl " PHP main version: "
|
||||
read PHP_VERSION
|
||||
if [ "X$PHP_VERSION" = "X" ]; then
|
||||
echo ""
|
||||
echo -e "\033[33m\033[1mInput is required !!\033[m"
|
||||
echo ""
|
||||
fi
|
||||
if [[ ! $PHP_VERSION =~ $main_version_regex ]] ; then
|
||||
echo ""
|
||||
echo -e "\033[33m\033[1mWrong entry (${PHP_VERSION}) for main PHP version !!\033[m"
|
||||
echo ""
|
||||
PHP_VERSION=
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
source ${snippet_dir}/get-php-major-version
|
||||
|
||||
if [[ -x "/usr/local/php-${PHP_VERSION}/bin/php" ]] ; then
|
||||
PHP_BIN="/usr/local/php-${PHP_VERSION}/bin/php"
|
||||
|
Reference in New Issue
Block a user