From debbeb08e12fc66efacdf190fbef8d9ea6bd8432 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Oct 2023 12:44:23 +0200 Subject: [PATCH] cleaning --- scripts/install | 5 ----- scripts/remove | 22 ---------------------- scripts/restore | 25 ++++++++----------------- scripts/upgrade | 32 -------------------------------- 4 files changed, 8 insertions(+), 76 deletions(-) diff --git a/scripts/install b/scripts/install index 6d55bce..d104e8c 100644 --- a/scripts/install +++ b/scripts/install @@ -67,11 +67,6 @@ ynh_script_progression --message="Configuring PHP-FPM" --weight=2 # Create a dedicated php-fpm config ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=1 - # Create a dedicated nginx config ynh_add_nginx_config diff --git a/scripts/remove b/scripts/remove index 89ebac2..7c463be 100644 --- a/scripts/remove +++ b/scripts/remove @@ -17,34 +17,12 @@ ynh_script_progression --message="Removing NGINX web server configuration..." -- # Remove the dedicated nginx config ynh_remove_nginx_config -#================================================= -# REMOVE PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1 - # Remove the dedicated php-fpm config ynh_remove_fpm_config -# Delete old static pool.d conf -old_php_version=7.0 -if [ -f /etc/php/$old_php_version/fpm/pool.d/$app.conf ]; then - ynh_secure_remove --file=/etc/php/$old_php_version/fpm/pool.d/$app.conf -fi - -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Removing logrotate configuration..." --weight=1 - # Remove the app-specific logrotate config ynh_remove_logrotate -#================================================= -# SPECIFIC REMOVE -#================================================= -# REMOVE APP FOLDERS -#================================================= - # Remove a directory securely ynh_secure_remove --file="/etc/$app" diff --git a/scripts/restore b/scripts/restore index f1d9dc2..f5feb25 100755 --- a/scripts/restore +++ b/scripts/restore @@ -17,6 +17,13 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" +#================================================= +# RESTORE THE MYSQL DATABASE +#================================================= +ynh_script_progression --message="Restoring the MySQL database..." --weight=27 + +ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql + #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= @@ -26,26 +33,10 @@ ynh_print_info --message="Reconfiguring PHP-FPM..." ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" # Recreate a dedicated php-fpm config -ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint - -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= +ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# RESTORE THE MYSQL DATABASE -#================================================= -ynh_script_progression --message="Restoring the MySQL database..." --weight=27 - -ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql - -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1 - ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index dce2c53..a7fe1c3 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -40,46 +40,14 @@ if [ -z "${fpm_usage:-}" ]; then ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage fi -# Delete existing ini configuration file (backward compatibility) -if [ -f /etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini ]; then - ynh_secure_remove --file=/etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini -fi - #================================================= # NGINX CONFIGURATION #================================================= ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 -ynh_backup_if_checksum_is_different --file="/etc/nginx/conf.d/$domain.d/$app.conf" - -# Delete current NGINX configuration to be able to check if .well-known is already served. -ynh_remove_nginx_config -ynh_app_setting_delete --app=$app --key="checksum__etc_nginx_conf.d_$domain.d_$app.conf" - -# Wait untils NGINX has fully reloaded -ynh_systemd_action --service_name=nginx --action=reload --line_match="Reloaded" --log_path="systemd" - # Create a dedicated nginx config ynh_add_nginx_config -#================================================= -# PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 - -# If php has changed, remove the old fpm config file -# if [ "$phpversion" != $YNH_PHP_VERSION ] -# then - # ynh_backup_if_checksum_is_different --file="/etc/php/$phpversion/fpm/pool.d/$app.conf" - # ynh_secure_remove --file="/etc/php/$phpversion/fpm/pool.d/$app.conf" - # if [ -f /etc/php/$phpversion/fpm/conf.d/20-$app.ini ]; then - # ynh_secure_remove --file="/etc/php/$phpversion/fpm/conf.d/20-$app.ini" - # fi - # ynh_systemd_action --service_name="php${phpversion}-fpm" --action=reload - - # phpversion="$YNH_PHP_VERSION" -# fi - # Recreate a dedicated PHP-FPM config ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint