From 4801ff47a88351402b4f33c99f2778e4eb31ff56 Mon Sep 17 00:00:00 2001 From: Florent Date: Sun, 15 Oct 2023 11:51:39 +0200 Subject: [PATCH] Reinstall all the dependencies when changing php version #131 --- manifest.toml | 6 +++--- scripts/config | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/manifest.toml b/manifest.toml index 2226004..3bcb9e9 100644 --- a/manifest.toml +++ b/manifest.toml @@ -70,15 +70,15 @@ ram.runtime = "50M" [resources.apt] packages = "nginx" # Kind of "dummy" value to be sure to have a non-empty dep list packages_from_raw_bash = """ - if [[ "$database" == "mysql" ]]; then + if [[ "$database" == "mysql" ]]; then echo "mariadb-server" - + if [[ "$phpversion" != none ]]; then echo "php${phpversion}-mysql" fi elif [[ "$database" == "postgresql" ]]; then echo "postgresql postgresql-contrib" - + if [[ "$phpversion" != none ]]; then echo "php${phpversion}-pgsql" fi diff --git a/scripts/config b/scripts/config index 65a87ca..1ff9b49 100644 --- a/scripts/config +++ b/scripts/config @@ -127,7 +127,10 @@ ynh_app_config_apply() { ynh_secure_remove --file="$nginx_extra_conf_dir/php.conf" else ynh_add_config --template="nginx-php.conf" --destination="$nginx_extra_conf_dir/php.conf" - ynh_install_app_dependencies "php${phpversion}-fpm" + database=$(ynh_app_setting_get --app=$app --key=database) + dependencies="$(ynh_read_manifest -k "resources.apt.packages")" + dependencies_from_raw_bash=$(eval "$(ynh_read_manifest -k "resources.apt.packages_from_raw_bash")" | tr "\n" " ") + ynh_install_app_dependencies "$dependencies $dependencies_from_raw_bash" ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion # ^ the helper takes care of ynh_app_setting_set the phpversion fi