mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Use the default php version into the php helpers
This commit is contained in:
parent
0081d988ab
commit
a489a06daa
1 changed files with 10 additions and 5 deletions
|
@ -1,5 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Declare the actual php version to use.
|
||||
# A packager willing to use another version of php can override the variable into its _common.sh.
|
||||
YNH_PHP_VERSION=${YNH_PHP_VERSION:-$YNH_DEFAULT_PHP_VERSION}
|
||||
|
||||
# Create a dedicated php-fpm config
|
||||
#
|
||||
# usage: ynh_add_fpm_config [--phpversion=7.X]
|
||||
|
@ -14,8 +18,8 @@ ynh_add_fpm_config () {
|
|||
# Manage arguments with getopts
|
||||
ynh_handle_getopts_args "$@"
|
||||
|
||||
# Configure PHP-FPM 7.0 by default
|
||||
phpversion="${phpversion:-7.0}"
|
||||
# Set the default PHP-FPM version by default
|
||||
phpversion="${phpversion:-$YNH_PHP_VERSION}"
|
||||
|
||||
local fpm_config_dir="/etc/php/$phpversion/fpm"
|
||||
local fpm_service="php${phpversion}-fpm"
|
||||
|
@ -26,6 +30,7 @@ ynh_add_fpm_config () {
|
|||
fi
|
||||
ynh_app_setting_set --app=$app --key=fpm_config_dir --value="$fpm_config_dir"
|
||||
ynh_app_setting_set --app=$app --key=fpm_service --value="$fpm_service"
|
||||
ynh_app_setting_set --app=$app --key=phpversion --value=$phpversion
|
||||
finalphpconf="$fpm_config_dir/pool.d/$app.conf"
|
||||
ynh_backup_if_checksum_is_different --file="$finalphpconf"
|
||||
cp ../conf/php-fpm.conf "$finalphpconf"
|
||||
|
@ -56,10 +61,10 @@ ynh_add_fpm_config () {
|
|||
ynh_remove_fpm_config () {
|
||||
local fpm_config_dir=$(ynh_app_setting_get --app=$app --key=fpm_config_dir)
|
||||
local fpm_service=$(ynh_app_setting_get --app=$app --key=fpm_service)
|
||||
# Assume php version 7 if not set
|
||||
# Assume default php version if not set
|
||||
if [ -z "$fpm_config_dir" ]; then
|
||||
fpm_config_dir="/etc/php/7.0/fpm"
|
||||
fpm_service="php7.0-fpm"
|
||||
fpm_config_dir="/etc/php/$YNH_DEFAULT_PHP_VERSION/fpm"
|
||||
fpm_service="php$YNH_DEFAULT_PHP_VERSION-fpm"
|
||||
fi
|
||||
ynh_secure_remove --file="$fpm_config_dir/pool.d/$app.conf"
|
||||
ynh_secure_remove --file="$fpm_config_dir/conf.d/20-$app.ini" 2>&1
|
||||
|
|
Loading…
Add table
Reference in a new issue