From fb3bfc1ed3f9f4dc94dd952ef942d56fd7aebda2 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 17 May 2019 16:05:27 +0200 Subject: [PATCH] reorder steps --- scripts/_common.sh | 2 +- scripts/install | 29 ++++++++++++++++++----------- scripts/remove | 27 +++++++++++++++++---------- scripts/restore | 22 ++++++++++++++-------- scripts/upgrade | 10 ++++++++-- 5 files changed, 58 insertions(+), 32 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index c98bf55..4a718ad 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # dependencies used by the app -pkg_dependencies="deb1 deb2" +pkg_dependencies="curl libzip-dev" extra_pkg_dependencies="php7.2-fpm php7.2-cli php7.2-gd php7.2-mysql php7.2-xml php7.2-ldap php7.2-mbstring php7.2-uploadprogress" diff --git a/scripts/install b/scripts/install index ad720c4..e936fd1 100644 --- a/scripts/install +++ b/scripts/install @@ -65,9 +65,7 @@ ynh_app_setting_set --app=$app --key=install_profil --value=$install_profil #================================================= ynh_print_info --message="Installing dependencies..." -ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies" - -#ynh_install_app_dependencies $pkg_dependencies +ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE A MYSQL DATABASE @@ -79,14 +77,6 @@ db_user=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name -#================================================= -# CREATE FINAL PATH -#================================================= -ynh_print_info --message="Creating final path..." - -ynh_app_setting_set --app=$app --key=final_path --value=$final_path -mkdir -p "$final_path" - #================================================= # NGINX CONFIGURATION #================================================= @@ -113,6 +103,22 @@ ynh_add_fpm_config --phpversion="7.2" #================================================= # SPECIFIC SETUP +#================================================= +# CREATE FINAL PATH +#================================================= +ynh_print_info --message="Creating final path..." + +ynh_app_setting_set --app=$app --key=final_path --value=$final_path +mkdir -p "$final_path" + +#================================================= +# INSTALL PHP 7.2 +#================================================= +ynh_print_info --message="Installing PHP 7.2..." + + +ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies" + #================================================= # CREATE DRUSH ALIAS #================================================= @@ -209,6 +215,7 @@ fi ynh_print_info --message="Reloading nginx web server..." ynh_systemd_action --service_name=nginx --action=reload +ynh_systemd_action --service_name=php7.2-fpm --action=reload #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index 8c83a9b..90f721b 100644 --- a/scripts/remove +++ b/scripts/remove @@ -34,22 +34,13 @@ ynh_print_info --message="Removing the MySQL database..." # Remove a database if it exists, along with the associated user ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name -#================================================= -# REMOVE PHP-FPM CONFIGURATION -#================================================= -ynh_print_info --message="Removing php-fpm configuration..." - -# Remove the dedicated php-fpm config -ynh_remove_fpm_config - #================================================= # REMOVE DEPENDENCIES #================================================= ynh_print_info --message="Removing dependencies..." # Remove metapackage and its dependencies -#ynh_remove_app_dependencies -ynh_remove_php +ynh_remove_app_dependencies #================================================= # REMOVE APP MAIN DIR @@ -67,15 +58,31 @@ ynh_print_info --message="Removing nginx web server configuration..." # Remove the dedicated nginx config ynh_remove_nginx_config +#================================================= +# REMOVE PHP-FPM CONFIGURATION +#================================================= +ynh_print_info --message="Removing php-fpm configuration..." + +# Remove the dedicated php-fpm config +ynh_remove_fpm_config + #================================================= # SPECIFIC REMOVE #================================================= # REMOVE THE CRON FILE #================================================= +ynh_print_info --message="Removing the cron file..." # Remove a cron file ynh_secure_remove --file="/etc/cron.d/$app" +#================================================= +# REMOVE PHP +#================================================= +ynh_print_info --message="Removing php..." + +ynh_remove_php + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/restore b/scripts/restore index 7014b28..b6d03b0 100644 --- a/scripts/restore +++ b/scripts/restore @@ -72,6 +72,12 @@ ynh_system_user_create --username=$app --home_dir="$final_path" # Restore permissions on app files chown -R $app: $final_path +#================================================= +# RESTORE THE PHP-FPM CONFIGURATION +#================================================= + +ynh_restore_file --origin_path="/etc/php/7.2/fpm/pool.d/$app.conf" + #================================================= # SPECIFIC RESTORATION #================================================= @@ -80,8 +86,7 @@ chown -R $app: $final_path ynh_print_info --message="Reinstalling dependencies..." # Define and install dependencies -#ynh_install_app_dependencies $pkg_dependencies -ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies" +ynh_install_app_dependencies $pkg_dependencies #================================================= # RESTORE THE MYSQL DATABASE @@ -92,18 +97,19 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql -#================================================= -# RESTORE THE PHP-FPM CONFIGURATION -#================================================= - -ynh_restore_file --origin_path="/etc/php/7.2/fpm/pool.d/$app.conf" - #================================================= # RESTORE THE CRON FILE #================================================= ynh_restore_file --origin_path="/etc/cron.d/$app" +#================================================= +# REINSTALL PHP +#================================================= +ynh_print_info --message="Reinstalling php..." + +ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies" + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 6db135f..8e86244 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -88,8 +88,7 @@ ynh_add_nginx_config #================================================= ynh_print_info --message="Upgrading dependencies..." -#ynh_install_app_dependencies $pkg_dependencies -ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies" +ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE DEDICATED USER @@ -109,6 +108,13 @@ ynh_add_fpm_config --phpversion="7.2" #================================================= # SPECIFIC UPGRADE +#================================================= +# UPDATE PHP +#================================================= +ynh_print_info --message="Updating PHP..." + +ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies" + #================================================= # UPDATE COMPOSER #=================================================