From 5e959596263e79fad25926fa3273a2ed9a18654d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 27 Dec 2023 13:50:11 +0100 Subject: [PATCH 1/3] Update install --- scripts/install | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/install b/scripts/install index bc59eb9..2f242f3 100644 --- a/scripts/install +++ b/scripts/install @@ -36,12 +36,10 @@ chown -R $app:www-data "$install_dir" #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring PHP-FPM..." --weight=2 +ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 -# Create a dedicated PHP-FPM config ynh_add_fpm_config -# Create a dedicated NGINX config ynh_add_nginx_config #================================================= @@ -86,7 +84,7 @@ ynh_local_curl "/install.php?language=$applanguage" "install=true" "dbhost=127.0 #================================================= # CONFIGURE PIWIGO #================================================= -ynh_script_progression --message="Configuring Piwigo..." +ynh_script_progression --message="Configuring $app..." --weight=2 # Change local config ynh_add_config --template="config.inc.php" --destination="$install_dir/local/config/config.inc.php" @@ -101,7 +99,7 @@ chown -R $app:www-data "$install_dir" #================================================= # ADD LDAP PLUGIN #================================================= -ynh_script_progression --message="Configuring LDAP plugin..." +ynh_script_progression --message="Configuring LDAP plugin..." --weight=2 # Activate the LDAP plugin using the WS API From fd06af237f701a09d67d048f505f5c3d770f994b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 27 Dec 2023 13:51:24 +0100 Subject: [PATCH 2/3] cleaning --- scripts/restore | 31 +++++++++++++------------------ scripts/upgrade | 4 +--- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/scripts/restore b/scripts/restore index 1243f54..26017de 100644 --- a/scripts/restore +++ b/scripts/restore @@ -30,9 +30,20 @@ ynh_restore_file --origin_path="$data_dir" --not_mandatory chown -R $app:www-data "$data_dir" #================================================= -# RESTORE FAIL2BAN CONFIGURATION +# RESTORE THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Restoring the Fail2Ban configuration..." --weight=7 +ynh_script_progression --message="Restoring the MySQL database..." --weight=2 + +ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql + +#================================================= +# RESTORE THE PHP-FPM CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 + +ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" touch "/var/log/${app}FailedLogins.log" chown $app: "/var/log/${app}FailedLogins.log" @@ -41,22 +52,6 @@ ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf" ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf" ynh_systemd_action --action=restart --service_name=fail2ban -#================================================= -# RESTORE THE PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=10 - -ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" - -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=2 - -ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 572a26f..33faca2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -68,12 +68,10 @@ chown -R $app:www-data "$install_dir" #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=3 +ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 -# Create a dedicated PHP-FPM config ynh_add_fpm_config -# Create a dedicated NGINX config ynh_add_nginx_config #================================================= From c48bf894d14526a44bab2e5587f32a8407e5f2bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 27 Dec 2023 13:52:03 +0100 Subject: [PATCH 3/3] Update upgrade --- scripts/upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 33faca2..5c235a2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -97,7 +97,7 @@ fi #================================================= # CONFIGURE PIWIGO #================================================= -ynh_script_progression --message="Configuring Piwigo..." +ynh_script_progression --message="Configuring $app..." --weight=2 # Change local config ynh_add_config --template="config.inc.php" --destination="$install_dir/local/config/config.inc.php" @@ -112,7 +112,7 @@ chown -R $app:www-data "$install_dir" #================================================= # CONFIGURE LDAP PLUGIN #================================================= -ynh_script_progression --message="Configuring LDAP plugin..." +ynh_script_progression --message="Configuring LDAP plugin..." --weight=2 # Disable LDAP plugin to avoid warning messages during API call ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name <<< "DELETE FROM plugins WHERE id='Ldap_Login';"