This commit is contained in:
José Pedro Andrés 2024-09-01 18:39:31 +01:00 committed by GitHub
commit 22a05cde15
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 39 additions and 11 deletions

View file

@ -48,7 +48,7 @@ is_backend_template_valid $template
prepare_web_backend
# Deleting backend
rm -f $pool/$backend_type.conf
delete_web_backend
# Allocating backend port
backend_port=9000

View file

@ -63,7 +63,7 @@ if [ "$WEB_BACKEND_POOL" = 'user' ]; then
fi
# Deleting backend
rm -f $pool/$backend_type.conf
delete_web_backend
#----------------------------------------------------------#

View file

@ -62,11 +62,11 @@ fi
if [ ! -z "$WEB_BACKEND" ]; then
if [ "$WEB_BACKEND_POOL" = 'user' ]; then
prepare_web_backend
rm -f $pool/$backend_type.conf
delete_web_backend
else
for domain in $($BIN/v-list-web-domains $user plain |cut -f 1); do
prepare_web_backend
rm -f $pool/$backend_type.conf
delete_web_backend
done
fi
fi

View file

@ -50,12 +50,15 @@ if [ -z "$WEB_BACKEND" ] || [ "$WEB_BACKEND" = 'remote' ]; then
fi
# Restart system
php_fpm=$(ls /etc/init.d/php*-fpm* 2>/dev/null |cut -f 4 -d / |head -n 1)
if [ -z "$php_fpm" ]; then
php_fpm=$(ls /etc/init.d/php*-fpm* 2>/dev/null |cut -f 4 -d /)
for back in $php_fpm
do
if [ -z "$php_fpm" ]; then
service $WEB_BACKEND restart >/dev/null 2>&1
else
service $php_fpm restart >/dev/null 2>&1
fi
else
service $back restart >/dev/null 2>&1
fi
done
if [ $? -ne 0 ]; then
send_email_report

View file

@ -84,7 +84,27 @@ is_web_alias_new() {
# Prepare web backend
prepare_web_backend() {
pool=$(find -L /etc/php* -type d \( -name "pool.d" -o -name "*fpm.d" \))
pool=$(find -L /etc/php/ -name "$domain.conf" -exec dirname {} \;)
#
# Check if multiple-PHP installed
#
regex="socket-(\d+)_(\d+)"
if [[ $template =~ ^socket-([0-9])\_([0-9])$ ]]
then
version="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}"
pool=$(find -L /etc/php/$version -type d \( -name "pool.d" -o -name "*fpm.d" \))
else
if [ "$pool" == "" ]
then
version=`echo "<?php echo (float)phpversion();" | php`
pool=$(find -L /etc/php/$version -type d \( -name "pool.d" -o -name "*fpm.d" \))
fi
fi
#
# /Check if multiple-PHP installed
#
if [ ! -e "$pool" ]; then
check_result $E_NOTEXIST "php-fpm pool doesn't exist"
fi
@ -102,6 +122,11 @@ prepare_web_backend() {
fi
}
# Delete web backend
delete_web_backend() {
find -L /etc/php/ -type f -name "$backend_type.conf" -exec rm -f {} \;
}
# Prepare web aliases
prepare_web_aliases() {
i=1