mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Proper migration to new directory
This commit is contained in:
parent
b8a1687f88
commit
147b249007
1 changed files with 21 additions and 2 deletions
|
@ -17,17 +17,36 @@ ynh_add_fpm_config () {
|
||||||
# Configure PHP-FPM 7.0 by default
|
# Configure PHP-FPM 7.0 by default
|
||||||
phpversion="${phpversion:-7.0}"
|
phpversion="${phpversion:-7.0}"
|
||||||
|
|
||||||
local fpm_config_dir="/etc/php/$phpversion/fpm"
|
local fpm_config_dir="/etc/php/$phpversion/dedicated-fpm"
|
||||||
|
local old_fpm_config_dir="/etc/php/$phpversion/fpm"
|
||||||
local fpm_service="php${phpversion}-fpm-$app"
|
local fpm_service="php${phpversion}-fpm-$app"
|
||||||
# Configure PHP-FPM 5 on Debian Jessie
|
# Configure PHP-FPM 5 on Debian Jessie
|
||||||
if [ "$(ynh_get_debian_release)" == "jessie" ]; then
|
if [ "$(ynh_get_debian_release)" == "jessie" ]; then
|
||||||
fpm_config_dir="/etc/php5/fpm"
|
fpm_config_dir="/etc/php5/fpm"
|
||||||
fpm_service="php5-fpm"
|
fpm_service="php5-fpm"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Create the directory for fpm pools
|
||||||
|
mkdir -p "$fpm_config_dir/pool.d"
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=fpm_config_dir --value="$fpm_config_dir"
|
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=fpm_service --value="$fpm_service"
|
||||||
finalphpconf="$fpm_config_dir/pool.d/$app.conf"
|
finalphpconf="$fpm_config_dir/pool.d/$app.conf"
|
||||||
|
|
||||||
|
# Migrate from mutual php service to dedicated one.
|
||||||
|
if [ -e "$old_fpm_config_dir/pool.d/$app.conf" ]
|
||||||
|
then
|
||||||
|
ynh_print_info --message="Migrate to a dedicated php-fpm service for $app."
|
||||||
|
# Create a backup of the old file before migration
|
||||||
|
ynh_backup_if_checksum_is_different --file="$old_fpm_config_dir/pool.d/$app.conf"
|
||||||
|
# Remove the old php config file
|
||||||
|
ynh_secure_remove --file="$old_fpm_config_dir/pool.d/$app.conf"
|
||||||
|
# Reload php to release the socket and allow the dedicated service to use it
|
||||||
|
systemctl reload php${phpversion}-fpm
|
||||||
|
else
|
||||||
ynh_backup_if_checksum_is_different --file="$finalphpconf"
|
ynh_backup_if_checksum_is_different --file="$finalphpconf"
|
||||||
|
fi
|
||||||
|
|
||||||
cp ../conf/php-fpm.conf "$finalphpconf"
|
cp ../conf/php-fpm.conf "$finalphpconf"
|
||||||
ynh_replace_string --match_string="__NAMETOCHANGE__" --replace_string="$app" --target_file="$finalphpconf"
|
ynh_replace_string --match_string="__NAMETOCHANGE__" --replace_string="$app" --target_file="$finalphpconf"
|
||||||
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$finalphpconf"
|
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$finalphpconf"
|
||||||
|
|
Loading…
Add table
Reference in a new issue