mirror of
https://github.com/YunoHost-Apps/wordpress_ynh.git
synced 2024-09-03 20:36:10 +02:00
Actions and config_panel tests
This commit is contained in:
parent
00a1a6e7dd
commit
efa92603d7
4 changed files with 60 additions and 5 deletions
|
@ -6,6 +6,17 @@
|
||||||
language="fr_FR"
|
language="fr_FR"
|
||||||
multisite=0
|
multisite=0
|
||||||
is_public=1 (PUBLIC|public=1|private=0)
|
is_public=1 (PUBLIC|public=1|private=0)
|
||||||
|
; Actions
|
||||||
|
is_public=0|1
|
||||||
|
; Config_panel
|
||||||
|
main.is_public.is_public=0|1
|
||||||
|
main.overwrite_files.overwrite_nginx=0|1
|
||||||
|
main.overwrite_files.overwrite_phpfpm=0|1
|
||||||
|
main.global_config.email_type=0|1
|
||||||
|
main.php_fpm_config.footprint=low|medium|high
|
||||||
|
main.php_fpm_config.free_footprint=20
|
||||||
|
main.php_fpm_config.usage=low|medium|high
|
||||||
|
main.php_fpm_config.force_max_children=20|0
|
||||||
; Checks
|
; Checks
|
||||||
pkg_linter=1
|
pkg_linter=1
|
||||||
setup_sub_dir=1
|
setup_sub_dir=1
|
||||||
|
@ -19,6 +30,8 @@
|
||||||
multi_instance=1
|
multi_instance=1
|
||||||
port_already_use=0
|
port_already_use=0
|
||||||
change_url=1
|
change_url=1
|
||||||
|
actions=1
|
||||||
|
config_panel=1
|
||||||
;; Test avec multisite
|
;; Test avec multisite
|
||||||
; Manifest
|
; Manifest
|
||||||
domain="domain.tld" (DOMAIN)
|
domain="domain.tld" (DOMAIN)
|
||||||
|
|
|
@ -60,3 +60,9 @@ name = "Wordpress configuration"
|
||||||
choices = ["low", "medium", "high"]
|
choices = ["low", "medium", "high"]
|
||||||
default = "low"
|
default = "low"
|
||||||
help = "low: Personal usage, behind the sso. No RAM footprint when not used, but the impact on the processor can be high if many users are using the service.<br>medium: Low usage, few people or/and publicly accessible. Low RAM footprint, medium processor footprint when used.<br>high: High usage, frequently visited website. High RAM footprint, but lower on processor usage and quickly responding."
|
help = "low: Personal usage, behind the sso. No RAM footprint when not used, but the impact on the processor can be high if many users are using the service.<br>medium: Low usage, few people or/and publicly accessible. Low RAM footprint, medium processor footprint when used.<br>high: High usage, frequently visited website. High RAM footprint, but lower on processor usage and quickly responding."
|
||||||
|
|
||||||
|
[main.php_fpm_config.force_max_children]
|
||||||
|
ask = "Force the value of pm.max_children ?"
|
||||||
|
type = "number"
|
||||||
|
default = "0"
|
||||||
|
help = "Do not change this value unless you're sure about what you're doing !<br>pm.max_children is automatically defined by this formula: $max_ram / 2 / $footprint<br>You can force that value, and ignore the formula by changing the value here.<br>To reset to the default value, set to 0."
|
||||||
|
|
|
@ -8,6 +8,13 @@
|
||||||
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# MANAGE SCRIPT FAILURE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
|
ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS
|
# RETRIEVE ARGUMENTS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -16,6 +16,8 @@ source _ynh_add_fpm_config
|
||||||
|
|
||||||
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
||||||
|
|
||||||
|
fpm_config_dir=$(ynh_app_setting_get --app=$app --key=fpm_config_dir)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD VALUES
|
# LOAD VALUES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -61,6 +63,14 @@ free_footprint="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FREE_FOOTPRINT:-$old_free_footp
|
||||||
old_fpm_usage="$(ynh_app_setting_get --app=$app --key=fpm_usage)"
|
old_fpm_usage="$(ynh_app_setting_get --app=$app --key=fpm_usage)"
|
||||||
fpm_usage="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_USAGE:-$old_fpm_usage}"
|
fpm_usage="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_USAGE:-$old_fpm_usage}"
|
||||||
|
|
||||||
|
# php_forced_max_children for php-fpm
|
||||||
|
old_php_forced_max_children="$(ynh_app_setting_get --app=$app --key=php_forced_max_children)"
|
||||||
|
# If php_forced_max_children isn't into settings.yml, get the current value from the fpm config
|
||||||
|
if [ -z "$old_php_forced_max_children" ]; then
|
||||||
|
old_php_forced_max_children="$(grep "^pm.max_children" "$fpm_config_dir/pool.d/$app.conf" | awk '{print $3}')"
|
||||||
|
fi
|
||||||
|
php_forced_max_children="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FORCE_MAX_CHILDREN:-$old_php_forced_max_children}"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SHOW_CONFIG FUNCTION FOR 'SHOW' COMMAND
|
# SHOW_CONFIG FUNCTION FOR 'SHOW' COMMAND
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -79,6 +89,7 @@ show_config() {
|
||||||
ynh_return "YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FOOTPRINT=$fpm_footprint"
|
ynh_return "YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FOOTPRINT=$fpm_footprint"
|
||||||
ynh_return "YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FREE_FOOTPRINT=$free_footprint"
|
ynh_return "YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FREE_FOOTPRINT=$free_footprint"
|
||||||
ynh_return "YNH_CONFIG_MAIN_PHP_FPM_CONFIG_USAGE=$fpm_usage"
|
ynh_return "YNH_CONFIG_MAIN_PHP_FPM_CONFIG_USAGE=$fpm_usage"
|
||||||
|
ynh_return "YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FORCE_MAX_CHILDREN=$php_forced_max_children"
|
||||||
}
|
}
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -88,12 +99,15 @@ show_config() {
|
||||||
apply_config() {
|
apply_config() {
|
||||||
|
|
||||||
# Change public accessibility
|
# Change public accessibility
|
||||||
|
if [ "$is_public" != "$old_is_public" ]
|
||||||
|
then
|
||||||
if [ "$is_public" = "1" ]
|
if [ "$is_public" = "1" ]
|
||||||
then
|
then
|
||||||
yunohost app action run $app public_private --args is_public=1
|
yunohost app action run $app public_private --args is_public=1
|
||||||
else
|
else
|
||||||
yunohost app action run $app public_private --args is_public=0
|
yunohost app action run $app public_private --args is_public=0
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY OVERWRITTING SETTINGS
|
# MODIFY OVERWRITTING SETTINGS
|
||||||
|
@ -116,7 +130,10 @@ apply_config() {
|
||||||
# RECONFIGURE PHP-FPM
|
# RECONFIGURE PHP-FPM
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [ "$fpm_usage" != "$old_fpm_usage" ] || [ "$fpm_footprint" != "$old_fpm_footprint" ] || [ "$free_footprint" != "$old_free_footprint" ]
|
if [ "$fpm_usage" != "$old_fpm_usage" ] || \
|
||||||
|
[ "$fpm_footprint" != "$old_fpm_footprint" ] || \
|
||||||
|
[ "$free_footprint" != "$old_free_footprint" ] || \
|
||||||
|
[ "$php_forced_max_children" != "$old_php_forced_max_children" ]
|
||||||
then
|
then
|
||||||
# If fpm_footprint is set to 'specific', use $free_footprint value.
|
# If fpm_footprint is set to 'specific', use $free_footprint value.
|
||||||
if [ "$fpm_footprint" = "specific" ]
|
if [ "$fpm_footprint" = "specific" ]
|
||||||
|
@ -124,6 +141,18 @@ apply_config() {
|
||||||
fpm_footprint=$free_footprint
|
fpm_footprint=$free_footprint
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$php_forced_max_children" != "$old_php_forced_max_children" ]
|
||||||
|
then
|
||||||
|
# Set php_forced_max_children
|
||||||
|
if [ $php_forced_max_children -ne 0 ]
|
||||||
|
then
|
||||||
|
ynh_app_setting_set --app=$app --key=php_forced_max_children --value="$php_forced_max_children"
|
||||||
|
else
|
||||||
|
# If the value is set to 0, remove the setting
|
||||||
|
ynh_app_setting_delete --app=$app --key=php_forced_max_children
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$fpm_footprint" != "0" ]
|
if [ "$fpm_footprint" != "0" ]
|
||||||
then
|
then
|
||||||
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
|
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
|
||||||
|
|
Loading…
Add table
Reference in a new issue