mod_php_install.sh: show existing FPM pool definitions in summary.

This commit is contained in:
Christoph 2024-01-03 14:11:09 +01:00
parent 7b17ac342a
commit dae3f913bb

View File

@ -77,6 +77,10 @@ _CRONTAB_BAKUP_FILE="$(mktemp)"
_VSERVER_GUEST=no _VSERVER_GUEST=no
# Array oft existing FPM pool definitions
#
declare -a php_fpm_pool_definition_file_arr=()
_backup_date="$(date +%Y%m%d-%H%M)" _backup_date="$(date +%Y%m%d-%H%M)"
@ -802,6 +806,7 @@ if $WITH_PHP_FPM_SUPPORT ; then
# If php pool definitions exists on installed php, then take that value # If php pool definitions exists on installed php, then take that value
# #
if [[ -d "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/" ]]; then
if [[ -f "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" ]] ; then if [[ -f "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" ]] ; then
__pm_start_servers=$(grep -e "^\s*pm.start_servers" "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" | awk '{print$3}') __pm_start_servers=$(grep -e "^\s*pm.start_servers" "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/www-${PHP_MAIN_VERSION}.php-fpm.conf" | awk '{print$3}')
if [[ -n "$__pm_start_servers" ]] ; then if [[ -n "$__pm_start_servers" ]] ; then
@ -837,6 +842,16 @@ if $WITH_PHP_FPM_SUPPORT ; then
fi fi
fi fi
# Get existing FPM pool definitions
#
for _file in $(ls "/usr/local/php-${PHP_MAIN_VERSION}/etc/fpm.d/") ; do
[[ "${_file}" =~ conf$ ]] || continue
[[ "${_file}" = "www-${PHP_MAIN_VERSION}.php-fpm.conf" ]] && continue
php_fpm_pool_definition_file_arr+=("${_file}")
done
fi
echo "" echo ""
echo "" echo ""
@ -2149,8 +2164,8 @@ if $WITH_PHP_FPM_SUPPORT ; then
echo " PHP socket .......................: $FPM_DEFAULT_POOL_LISTEN" echo " PHP socket .......................: $FPM_DEFAULT_POOL_LISTEN"
echo "" echo ""
echo " PHP FPM Socket definition(s)......: ${FPM_DEFAULT_POOL}.php-fpm.conf" echo " PHP FPM Socket definition(s)......: ${FPM_DEFAULT_POOL}.php-fpm.conf"
if [[ ${#existing_fpm_definition_arr[@]} -gt 0 ]] ; then if [[ ${#php_fpm_pool_definition_file_arr[@]} -gt 0 ]] ; then
for _file in "${existing_fpm_definition_arr[@]}" ; do for _file in "${php_fpm_pool_definition_file_arr[@]}" ; do
[[ "$(basename "$_file")" = "${FPM_DEFAULT_POOL}.php-fpm.conf" ]] && continue [[ "$(basename "$_file")" = "${FPM_DEFAULT_POOL}.php-fpm.conf" ]] && continue
echo " $(basename "$_file")" echo " $(basename "$_file")"
done done