diff --git a/conf/nginx.conf b/conf/nginx.conf index 8c92d22..3f4d62f 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -32,7 +32,7 @@ location __PATH__/ { # Execute and serve PHP files location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php/php__PHP_CUSTOM__-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param REMOTE_USER $remote_user; diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index 65d7b6a..b7b62c5 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -33,7 +33,7 @@ group = __USER__ ; (IPv6 and IPv4-mapped) on a specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = /var/run/php/php__PHP_CUSTOM__-fpm-__NAMETOCHANGE__.sock +listen = /var/run/php/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock ; Set listen(2) backlog. ; Default Value: 511 (-1 on FreeBSD and OpenBSD) diff --git a/manifest.json b/manifest.json index 6bb9539..8c366f8 100644 --- a/manifest.json +++ b/manifest.json @@ -58,7 +58,7 @@ "default": true }, { - "name": "php_custom", + "name": "phpversion", "type": "string", "ask": { "en": "Choose a PHP version you want to use for your app", diff --git a/scripts/_common.sh b/scripts/_common.sh index 3c8d0ba..ed3594e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,8 +4,6 @@ # COMMON VARIABLES #================================================= -YNH_PHP_VERSION="$php_custom" - #================================================= # EXPERIMENTAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index 7683783..02c3e3b 100644 --- a/scripts/backup +++ b/scripts/backup @@ -28,7 +28,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) db_name=$(ynh_app_setting_get --app=$app --key=db_name) with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp) -php_custom=$(ynh_app_setting_get --app=$app --key=php_custom) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -51,7 +51,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" # BACKUP THE PHP-FPM CONFIGURATION #================================================= -ynh_backup --src_path="/etc/php/$php_custom/fpm/pool.d/$app.conf" +ynh_backup --src_path="/etc/php/${phpversion}/fpm/pool.d/$app.conf" #================================================= # BACKUP THE MYSQL DATABASE diff --git a/scripts/install b/scripts/install index d8875a6..3d8ac96 100644 --- a/scripts/install +++ b/scripts/install @@ -25,7 +25,7 @@ path_url=$YNH_APP_ARG_PATH with_sftp=$YNH_APP_ARG_WITH_SFTP password=$YNH_APP_ARG_PASSWORD is_public=$YNH_APP_ARG_IS_PUBLIC -php_custom=$YNH_APP_ARG_PHP_CUSTOM +phpversion=$YNH_APP_ARG_PHPVERSION with_mysql=$YNH_APP_ARG_WITH_MYSQL @@ -53,7 +53,7 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=with_mysql --value=$with_mysql ynh_app_setting_set --app=$app --key=with_sftp --value=$with_sftp ynh_app_setting_set --app=$app --key=final_path --value=$final_path -ynh_app_setting_set --app=$app --key=php_custom --value=$php_custom +ynh_app_setting_set --app=$app --key=phpversion --value=$phpversion ynh_app_setting_set --app=$app --key=admin_mail_html --value=1 @@ -142,7 +142,7 @@ chmod o-rwx "$final_path" ynh_script_progression --message="Configuring PHP-FPM..." --weight=2 # Create a dedicatedPHP-FPM config -ynh_add_fpm_config --usage=low --footprint=low --phpversion=$php_custom +ynh_add_fpm_config --usage=low --footprint=low --phpversion=$phpversion #================================================= # GENERIC FINALIZATION diff --git a/scripts/restore b/scripts/restore index 3dfae49..18f23a2 100644 --- a/scripts/restore +++ b/scripts/restore @@ -30,7 +30,7 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp) password=$(ynh_app_setting_get --app=$app --key=password) -php_custom=$(ynh_app_setting_get --app=$app --key=php_custom) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -100,7 +100,7 @@ chmod o-rwx "$final_path" # RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_restore_file --origin_path="/etc/php/${php_custom}/fpm/pool.d/$app.conf" +ynh_restore_file --origin_path="/etc/php/${phpversion}/fpm/pool.d/$app.conf" #================================================= # SPECIFIC RESTORATION @@ -113,7 +113,7 @@ ynh_restore_file --origin_path="/etc/php/${php_custom}/fpm/pool.d/$app.conf" #================================================= ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." -ynh_systemd_action --service_name=php${php_custom}-fpm --action=reload +ynh_systemd_action --service_name=php${phpversion}-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 82549be..0cbd54c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -23,7 +23,7 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp) password=$(ynh_app_setting_get --app=$app --key=password) -php_custom=$(ynh_app_setting_get --app=$app --key=php_custom) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) admin_mail_html=$(ynh_app_setting_get --app=$app --key=admin_mail_html) @@ -84,12 +84,6 @@ if [ -z "$with_sftp" ]; then ynh_app_setting_set --app=$app --key=with_sftp --value=$with_sftp fi -# If with_sftp doesn't exist, create it -if [ -z "$php_custom" ]; then - php_custom="7.3" - ynh_app_setting_set --app=$app --key=php_custom --value=$php_custom -fi - # Cleaning legacy permissions if ynh_legacy_permissions_exists; then ynh_legacy_permissions_delete_all @@ -160,7 +154,7 @@ usermod -g "$app" "$app" ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 # Create a dedicated PHP-FPM config -ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$php_custom +ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion #================================================= # SPECIFIC UPGRADE