mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Merge pull request #373 from YunoHost/enh-phpfpm-helper-php7-stretch
Update php-fpm helpers to handle stretch/php7 and a smooth migration
This commit is contained in:
commit
92a3caa8b2
2 changed files with 30 additions and 7 deletions
|
@ -157,7 +157,17 @@ ynh_remove_nginx_config () {
|
|||
#
|
||||
# usage: ynh_add_fpm_config
|
||||
ynh_add_fpm_config () {
|
||||
finalphpconf="/etc/php5/fpm/pool.d/$app.conf"
|
||||
# Configure PHP-FPM 7.0 by default
|
||||
local fpm_config_dir="/etc/php/7.0/fpm"
|
||||
local fpm_service="php7.0-fpm"
|
||||
# Configure PHP-FPM 5 on Debian Jessie
|
||||
if [ "$(ynh_get_debian_release)" == "jessie" ]; then
|
||||
fpm_config_dir="/etc/php5/fpm"
|
||||
fpm_service="php5-fpm"
|
||||
fi
|
||||
ynh_app_setting_set $app fpm_config_dir "$fpm_config_dir"
|
||||
ynh_app_setting_set $app fpm_service "$fpm_service"
|
||||
finalphpconf="$fpm_config_dir/pool.d/$app.conf"
|
||||
ynh_backup_if_checksum_is_different "$finalphpconf"
|
||||
sudo cp ../conf/php-fpm.conf "$finalphpconf"
|
||||
ynh_replace_string "__NAMETOCHANGE__" "$app" "$finalphpconf"
|
||||
|
@ -168,21 +178,27 @@ ynh_add_fpm_config () {
|
|||
|
||||
if [ -e "../conf/php-fpm.ini" ]
|
||||
then
|
||||
finalphpini="/etc/php5/fpm/conf.d/20-$app.ini"
|
||||
finalphpini="$fpm_config_dir/conf.d/20-$app.ini"
|
||||
ynh_backup_if_checksum_is_different "$finalphpini"
|
||||
sudo cp ../conf/php-fpm.ini "$finalphpini"
|
||||
sudo chown root: "$finalphpini"
|
||||
ynh_store_file_checksum "$finalphpini"
|
||||
fi
|
||||
|
||||
sudo systemctl reload php5-fpm
|
||||
sudo systemctl reload $fpm_service
|
||||
}
|
||||
|
||||
# Remove the dedicated php-fpm config
|
||||
#
|
||||
# usage: ynh_remove_fpm_config
|
||||
ynh_remove_fpm_config () {
|
||||
ynh_secure_remove "/etc/php5/fpm/pool.d/$app.conf"
|
||||
ynh_secure_remove "/etc/php5/fpm/conf.d/20-$app.ini" 2>&1
|
||||
sudo systemctl reload php5-fpm
|
||||
local fpm_config_dir=$(ynh_app_setting_get $app fpm_config_dir)
|
||||
local fpm_service=$(ynh_app_setting_get $app fpm_service)
|
||||
# Assume php version 5 if not set
|
||||
if [ -z "$fpm_config_dir" ]; then
|
||||
fpm_config_dir="/etc/php5/fpm"
|
||||
fpm_service="php5-fpm"
|
||||
fi
|
||||
ynh_secure_remove "$fpm_config_dir/pool.d/$app.conf"
|
||||
ynh_secure_remove "$fpm_config_dir/conf.d/20-$app.ini" 2>&1
|
||||
sudo systemctl reload $fpm_service
|
||||
}
|
||||
|
|
|
@ -41,3 +41,10 @@ ynh_abort_if_errors () {
|
|||
set -eu # Exit if a command fail, and if a variable is used unset.
|
||||
trap ynh_exit_properly EXIT # Capturing exit signals on shell script
|
||||
}
|
||||
|
||||
# Return the Debian release codename (i.e. jessie, stretch, etc.)
|
||||
#
|
||||
# usage: ynh_get_debian_release
|
||||
ynh_get_debian_release () {
|
||||
echo $(lsb_release --codename --short)
|
||||
}
|
Loading…
Add table
Reference in a new issue