mirror of
https://github.com/YunoHost-Apps/my_webapp_ynh.git
synced 2024-09-03 19:46:26 +02:00
[fix] handling phpversion in config panel
Co-authored-by: Alexandre Aubin <alex.aubin@mailoo.org> Co-authored-by: ljf (zamentur) <zamentur@users.noreply.github.com>
This commit is contained in:
parent
1d8afa6ad6
commit
ee6a4cf5f8
3 changed files with 27 additions and 11 deletions
|
@ -16,7 +16,11 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
current_fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
|
|
||||||
|
fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
|
||||||
|
fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC GETTERS FOR TOML SHORT KEY
|
# SPECIFIC GETTERS FOR TOML SHORT KEY
|
||||||
|
@ -53,16 +57,26 @@ ynh_app_config_validate() {
|
||||||
ynh_app_config_apply() {
|
ynh_app_config_apply() {
|
||||||
_ynh_app_config_apply
|
_ynh_app_config_apply
|
||||||
|
|
||||||
|
if [ "${changed[phpversion]}" == "true" ]
|
||||||
if [ "${changed[phpversion]}" == "true" ] && [ "$phpversion" == "none" ]
|
|
||||||
then
|
then
|
||||||
# FIXME: This miserably fails because the setting phpversion get his
|
ynh_app_setting_set --app=$app --key=phpversion --value="${old[phpversion]}"
|
||||||
# new value before ynh_app_config_apply gets called, so
|
|
||||||
# ynh_remove_fpm_config try to remove the new not-yet-existent version.
|
|
||||||
ynh_remove_fpm_config
|
ynh_remove_fpm_config
|
||||||
elif [ "${changed[phpversion]}" == "true" ]
|
# ^ the helper includes ynh_remove_app_dependencies
|
||||||
|
YNH_PHP_VERSION=$phpversion
|
||||||
|
# ^ ynh_add_config replaces __PHPVERSION__ by __PHP_YNH_VERSION__...
|
||||||
|
ynh_app_setting_set --app=$app --key=phpversion --value="$phpversion"
|
||||||
|
|
||||||
|
if [ "$phpversion" == "none" ]
|
||||||
then
|
then
|
||||||
ynh_add_fpm_config --usage=low --footprint=low --phpversion=$phpversion
|
cp ../conf/nginx{_no_php,}.conf
|
||||||
|
else
|
||||||
|
cp ../conf/nginx{_with_php,}.conf
|
||||||
|
ynh_install_app_dependencies "php${phpversion}-fpm"
|
||||||
|
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion
|
||||||
|
# ^ the helper takes care of ynh_app_setting_set the phpversion
|
||||||
|
fi
|
||||||
|
|
||||||
|
ynh_add_nginx_config
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${changed[with_sftp]}" == "true" ] && [ $with_sftp -eq 1 ]
|
if [ "${changed[with_sftp]}" == "true" ] && [ $with_sftp -eq 1 ]
|
||||||
|
|
|
@ -95,6 +95,7 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2
|
||||||
if [ $phpversion != "none" ]
|
if [ $phpversion != "none" ]
|
||||||
then
|
then
|
||||||
cp ../conf/nginx{_with_php,}.conf
|
cp ../conf/nginx{_with_php,}.conf
|
||||||
|
YNH_PHP_VERSION="$phpversion"
|
||||||
else
|
else
|
||||||
cp ../conf/nginx{_no_php,}.conf
|
cp ../conf/nginx{_no_php,}.conf
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -91,9 +91,9 @@ if [ -z "$with_sftp" ]; then
|
||||||
ynh_app_setting_set --app=$app --key=with_sftp --value=$with_sftp
|
ynh_app_setting_set --app=$app --key=with_sftp --value=$with_sftp
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If phpversion doesn't exist, create it
|
# If phpversion doesn't exist, create it. We assume it is the default system one.
|
||||||
if [ -z "$phpversion" ]; then
|
if [ -z "$phpversion" ]; then
|
||||||
phpversion=$YNH_PHP_VERSION
|
phpversion=$YNH_DEFAULT_PHP_VERSION
|
||||||
ynh_app_setting_set --app=$app --key=phpversion --value=$phpversion
|
ynh_app_setting_set --app=$app --key=phpversion --value=$phpversion
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -145,6 +145,7 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
|
||||||
if [ $phpversion != "none" ]
|
if [ $phpversion != "none" ]
|
||||||
then
|
then
|
||||||
cp ../conf/nginx{_with_php,}.conf
|
cp ../conf/nginx{_with_php,}.conf
|
||||||
|
YNH_PHP_VERSION="$phpversion"
|
||||||
else
|
else
|
||||||
cp ../conf/nginx{_no_php,}.conf
|
cp ../conf/nginx{_no_php,}.conf
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Reference in a new issue