upgrade_roundcube.sh: fix error in determin php major versions.

This commit is contained in:
Christoph 2022-06-27 01:10:40 +02:00
parent 253cca17a4
commit d9d3987908

View File

@ -289,6 +289,29 @@ if [[ "$NEW_INSTALL_DIR" = "$CUR_INSTALL_DIR" ]] ; then
fi fi
# - Determin PHP of all installed versions
# -
if $PHP_DEBIAN_INSTALLATION ; then
echononl " Get get major version installed PHP"
php_major_version="$(php --version | head -1 | cut -d' ' -f2 | cut -d '-' -f1 | cut -d'.' -f1,2)"
if [[ -z "$php_major_version" ]]; then
echo_failed
error "Getting version numbers of installed PHP versions failed! No installed PHP versiond found!"
else
echo_ok
fi
else
echononl " Get major version of all installed PHP versions"
IFS=$'\n' php_major_versions="$(find /usr/local/ -maxdepth 1 -mindepth 1 -type l -name "php-*" -print | cut -d "-" -f2 | sort)"
if [[ -z "$php_major_versions" ]]; then
echo_failed
error "Getting version numbers of installed PHP versions failed! No installed PHP versiond found!"
else
echo_ok
fi
fi
echo "" echo ""
echo "" echo ""
echo -e "\033[1;32mSettings for upgrading \033[1;37mRoundcube Webmail\033[m" echo -e "\033[1;32mSettings for upgrading \033[1;37mRoundcube Webmail\033[m"
@ -325,6 +348,22 @@ if [[ "$DB_TYPE" = "mysql" ]]; then
echo -e "\tMySQL Credentials (root access)......: $MYSQL_CREDENTIALS" echo -e "\tMySQL Credentials (root access)......: $MYSQL_CREDENTIALS"
fi fi
echo "" echo ""
if $PHP_DEBIAN_INSTALLATION ; then
echo -e "\tInstalled PHP version................: $php_major_version"
else
declare -i index=1
for _ver in $php_major_versions ; do
if [[ $index -eq 1 ]] ; then
echo -en "\tInstalled PHP versions...............: $_ver"
else
echo -en " $_ver"
fi
((index++))
done
echo ""
echo -e "\tNewest PHP Version...................: $php_latest_ver"
fi
echo ""
echo -e "\tCrontab backup file..................: $crontab_backup_file" echo -e "\tCrontab backup file..................: $crontab_backup_file"
echo "" echo ""
@ -495,29 +534,6 @@ else
fi fi
# - Determin PHP of all installed versions
# -
if $PHP_DEBIAN_INSTALLATION ; then
echononl " Get get major version installed PHP"
php_major_version="$(php --version | head -1 | cut -d' ' -f2 | cut -d '-' -f1 | cut -d'.' -f1,2)"
if [[ -z "$php_major_version" ]]; then
echo_failed
error "Getting version numbers of installed PHP versions failed! No installed PHP versiond found!"
else
echo_ok
fi
else
echononl " Get major version of all installed PHP versions"
php_major_versions="$(find /usr/local/ -maxdepth 1 -mindepth 1 -type l -name "php-*" -print | cut -d "-" -f2 | sort)"
if [[ -z "$php_major_versions" ]]; then
echo_failed
error "Getting version numbers of installed PHP versions failed! No installed PHP versiond found!"
else
echo_ok
fi
fi
# - Stop all PHP FPM engines # - Stop all PHP FPM engines
# - # -
if [[ -n "$php_major_versions" ]]; then if [[ -n "$php_major_versions" ]]; then