From 1d26d90d5c0853421983ff5d134de18d77f16946 Mon Sep 17 00:00:00 2001 From: maniack Date: Tue, 2 Jul 2019 12:38:38 +0200 Subject: [PATCH] Move back to config script --- scripts/config | 24 +++++++- .../config-panel_scripts/configure_php_fpm | 57 ------------------- 2 files changed, 22 insertions(+), 59 deletions(-) delete mode 100755 scripts/config-panel_scripts/configure_php_fpm diff --git a/scripts/config b/scripts/config index 6615e6b..f0785cc 100644 --- a/scripts/config +++ b/scripts/config @@ -8,6 +8,7 @@ source _common.sh source /usr/share/yunohost/helpers +source _ynh_add_fpm_config #================================================= # RETRIEVE ARGUMENTS @@ -93,6 +94,11 @@ show_config() { #================================================= apply_config() { + + #================================================= + # MODIFY PUBLIC ACCESSIBILITY + #================================================= + # Change public accessibility if [ "$is_public" = "true" ] then @@ -101,6 +107,10 @@ apply_config() { yunohost app action run $app public_private --args is_public=0 fi + #================================================= + # MODIFY OVERWRITTING SETTINGS + #================================================= + # Set overwrite_nginx overwrite_nginx=$(bool_to_01 $overwrite_nginx) ynh_app_setting_set --app=$app --key=overwrite_nginx --value="$overwrite_nginx" @@ -108,12 +118,22 @@ apply_config() { overwrite_phpfpm=$(bool_to_01 $overwrite_phpfpm) ynh_app_setting_set --app=$app --key=overwrite_phpfpm --value="$overwrite_phpfpm" + #================================================= + # MODIFY EMAIL SETTING + #================================================= + # Set admin_mail_html admin_mail_html=$(bool_to_01 $admin_mail_html) ynh_app_setting_set --app=$app --key=admin_mail_html --value="$admin_mail_html" - # Reconfigure php-fpm - config-panel_scripts/configure_php_fpm --fpm_usage=$fpm_usage --fpm_footprint=$fpm_footprint + #================================================= + # RECONFIGURE PHP-FPM + #================================================= + + if [ "$fpm_usage" != "$old_fpm_usage" ] || [ "$fpm_footprint" != "$old_fpm_footprint" ] + then + ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint + fi } #================================================= diff --git a/scripts/config-panel_scripts/configure_php_fpm b/scripts/config-panel_scripts/configure_php_fpm deleted file mode 100755 index abaf34e..0000000 --- a/scripts/config-panel_scripts/configure_php_fpm +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash - -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - -source _common.sh -source /usr/share/yunohost/helpers -source _ynh_add_fpm_config - -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -fpm_usage="" -fpm_footprint="" -get_arguments () { - # Use ynh_handle_getopts_args into a function to not interfere with $args_array from helpers. - legacy_args=uf - # Declare an array to define the arguments - declare -Ar args_array=( [u]=fpm_usage= [f]=fpm_footprint= ) - # Manage arguments with getopts - ynh_handle_getopts_args "$@" -} -get_arguments "$@" - -app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID} - -#================================================= -# CHECK IF AN ACTION HAS TO BE DONE -#================================================= - -old_fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) -old_fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) - -if [ "$fpm_usage" == "$old_fpm_usage" ] && [ "$fpm_footprint" == "$old_fpm_footprint" ] -then - ynh_die --message="Nothing to change in PHP configuration." --ret_code=0 -fi - -#================================================= -# SPECIFIC ACTION -#================================================= -# RECONFIGURE PHP-FPM CONFIGURATION -#================================================= - -ynh_script_progression --message="Reconfiguring PHP-FPM configuration..." --weight=3 - -ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint - -#================================================= -# END OF SCRIPT -#================================================= - -ynh_script_progression --message="Execution completed" --last