diff --git a/scripts/install b/scripts/install index c3c0d2d..9530ba3 100755 --- a/scripts/install +++ b/scripts/install @@ -55,6 +55,7 @@ ynh_script_progression --message="Installing dependencies..." ynh_install_app_dependencies $pkg_dependencies ynh_install_php --php_version=$php_version +YNH_PHP_VERSION=$(ynh_app_setting_get --app=$app --key=php_version) #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE diff --git a/scripts/upgrade b/scripts/upgrade index 03269e9..1fc4f46 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -59,14 +59,6 @@ then cp -f ../sources/index.php /$final_path/. fi -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." - -# Create a dedicated NGINX config -ynh_add_nginx_config - #================================================= # UPGRADE DEPENDENCIES #================================================= @@ -74,6 +66,15 @@ ynh_script_progression --message="Upgrading dependencies..." ynh_install_app_dependencies $pkg_dependencies ynh_install_php --php_version=$php_version +YNH_PHP_VERSION=$(ynh_app_setting_get --app=$app --key=php_version) + +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Upgrading NGINX web server configuration..." + +# Create a dedicated NGINX config +ynh_add_nginx_config #================================================= # CREATE DEDICATED USER diff --git a/scripts/ynh_install_php b/scripts/ynh_install_php index 6f840ed..f2e75fe 100644 --- a/scripts/ynh_install_php +++ b/scripts/ynh_install_php @@ -196,17 +196,17 @@ ynh_install_php () { ynh_app_setting_set --app=$YNH_APP_INSTANCE_NAME --key=php_version --value=$final_php_version # Remove app virtualenv - if `phpenv alias --list | grep --quiet "$YNH_APP_INSTANCE_NAME" 1>/dev/null 2>&1` + if `phpenv alias --list | grep --quiet "$YNH_APP_INSTANCE_NAME " 1>/dev/null 2>&1` then phpenv alias $YNH_APP_INSTANCE_NAME --remove fi + # Create app virtualenv + phpenv alias $YNH_APP_INSTANCE_NAME $final_php_version + # Cleanup PHP versions ynh_cleanup_php - # Create app virtualenv - # phpenv alias $YNH_APP_INSTANCE_NAME $final_php_version - # Install php-fpm service cp -f "$php_version_path/$final_php_version/etc/systemd/system/php-fpm.service" "/etc/systemd/system/php$final_php_version-fpm.service" systemctl enable php$final_php_version-fpm --quiet @@ -238,6 +238,8 @@ ynh_remove_php () { # Remove /usr/local/bin in PATH in case of PHP prior installation PATH=$(echo $CLEAR_PATH | sed 's@/usr/local/bin:@@') + phpenv alias $YNH_APP_INSTANCE_NAME --remove + # Remove the line for this app ynh_app_setting_delete --app=$YNH_APP_INSTANCE_NAME --key=php_version @@ -293,11 +295,15 @@ ynh_cleanup_php () { ynh_add_fpm_config () { + php_version=$(ynh_app_setting_get --app=$app --key=php_version) ynh_use_php ynh_add_config --template="../conf/php-fpm.conf" --destination="$ynh_fpm_conf" + systemctl reload-or-restart php$php_version-fpm } ynh_remove_fpm_config () { + php_version=$(ynh_app_setting_get --app=$app --key=php_version) ynh_use_php ynh_secure_remove --file="$ynh_fpm_conf" + systemctl reload-or-restart php$php_version-fpm }