diff --git a/conf/nginx.conf b/conf/nginx.conf index e07a530..b73524a 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -26,7 +26,7 @@ if ($scheme = http) { location ~ [^/]\.php(/|$) { try_files $uri $uri/ /_route.php; fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php/php7.0-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 3f4bc72..5b710a8 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -30,7 +30,7 @@ group = __USER__ ; specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock +listen = /var/run/php/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock ; Set listen(2) backlog. A value of '-1' means unlimited. ; Default Value: 128 (-1 on FreeBSD and OpenBSD) diff --git a/manifest.json b/manifest.json index c2860ae..b1d0dfe 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Software to manage association", "fr": "Logiciel libre de gestion d'association" }, - "version": "0.9.8~ynh3", + "version": "0.9.8~ynh4", "url": "http://garradin.eu/a-propos/", "license": "GPL-3.0-or-later", "maintainer": { @@ -14,7 +14,7 @@ "email": "win10@tutanota.com" }, "requirements": { - "yunohost": ">=3.7.1" + "yunohost": ">=3.8.1" }, "multi_instance": true, "services": [ diff --git a/scripts/_common.sh b/scripts/_common.sh index 98e0574..2c8ba86 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,11 +4,10 @@ # COMMON VARIABLES #================================================= # dependencies used by the app -if [ "$lsb_release --codename --short" = "buster"]; then - pkg_dependencies="php7.3-sqlite3" -else [ "$lsb_release --codename --short" = "stretch"] - pkg_dependencies="php7.0-sqlite3" -fi + +YNH_PHP_VERSION="7.3" + +extra_php_dependencies="php${YNH_PHP_VERSION}-sqlite3" #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index 21116d2..2ba0d4f 100644 --- a/scripts/backup +++ b/scripts/backup @@ -26,6 +26,7 @@ app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -50,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/7.0/fpm/pool.d/$app.conf" +ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index b5a23ea..c445033 100644 --- a/scripts/install +++ b/scripts/install @@ -49,13 +49,6 @@ ynh_script_progression --message="Storing installation settings..." --weight=1 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url -#================================================= -# Install dependency to convert tracks to a readable format for the browser -#================================================= -ynh_script_progression --message="Installing dependencies..." --weight=10 - -ynh_install_app_dependencies $pkg_dependencies - #================================================= # CREATE DEDICATED USER #================================================= @@ -77,6 +70,7 @@ ynh_setup_source --dest_dir="$final_path" # NGINX CONFIGURATION #================================================= ynh_script_progression --message="Configuring NGINX web server..." --weight=2 + # Create a dedicated nginx config ynh_add_nginx_config @@ -85,8 +79,9 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Configuring PHP-FPM..." --weight=5 -# Create a dedicated php-fpm config -ynh_add_fpm_config +# Create a dedicated PHP-FPM config +ynh_add_fpm_config --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies" +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # Files owned by user app @@ -133,7 +128,7 @@ fi #================================================= ynh_script_progression --message="Reloading NGINX web server..." --weight=1 -systemctl reload nginx +ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index 3726ba2..2c407ff 100644 --- a/scripts/restore +++ b/scripts/restore @@ -27,6 +27,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -71,26 +72,12 @@ chown -R $app:$app $final_path #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Restore php-fpm configuration..." --weight=1 +ynh_script_progression --message="Reconfiguring PHP-FPM..." --weight=50 -ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf" +ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" -#================================================= -# SPECIFIC RESTORATION -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=10 +ynh_add_fpm_config --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies" -# Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies - -#================================================= -# RESTORE THE PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Restore PHP-FPM configuration..." --weight=30 - -ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf" #================================================= # GENERIC FINALIZATION #================================================= @@ -98,7 +85,7 @@ ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf" #================================================= ynh_script_progression --message="Reloading nginx web server and php-fpm..." --weight=1 -ynh_systemd_action --service_name=php7.0-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 396e7bc..f2ada7e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -19,6 +19,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) || ynh_die "This path already contains a folder" +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK VERSION @@ -100,13 +101,6 @@ then ynh_setup_source --dest_dir="$final_path" fi -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=5 - -ynh_install_app_dependencies $pkg_dependencies - #================================================= # CREATE DEDICATED USER #================================================= @@ -129,7 +123,7 @@ ynh_add_nginx_config ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 # Create a dedicated PHP-FPM config -ynh_add_fpm_config +ynh_add_fpm_config --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies" #======================================================= # backup bdd, squelettes directory and config.local.php