From 1f5ff188f7cb17d11af8a39217811b25099bb96d Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 15 Mar 2018 01:06:50 +0100 Subject: [PATCH] Also patch nginx conf for the php5/7 migration --- .../0004_php5_to_php7_pools.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/yunohost/data_migrations/0004_php5_to_php7_pools.py b/src/yunohost/data_migrations/0004_php5_to_php7_pools.py index 0ff9b77c8..560b7a25c 100644 --- a/src/yunohost/data_migrations/0004_php5_to_php7_pools.py +++ b/src/yunohost/data_migrations/0004_php5_to_php7_pools.py @@ -51,6 +51,16 @@ class MyMigration(Migration): # Reload/restart the php pools _run_service_command("restart", "php7.0-fpm") + # Get list of nginx conf file + nginx_conf_files = glob.glob("/etc/nginx/conf.d/*.d/*.conf") + for f in nginx_conf_files: + # Replace the socket prefix if it's found + c = "sed -i -e 's@{}@{}@g' {}".format(PHP5_SOCKETS_PREFIX, PHP7_SOCKETS_PREFIX, f) + os.system(c) + + # Reload nginx + _run_service_command("reload", "nginx") + def backward(self): # Get list of php7 pool files @@ -65,3 +75,13 @@ class MyMigration(Migration): # Reload/restart the php pools _run_service_command("restart", "php7.0-fpm") + + # Get list of nginx conf file + nginx_conf_files = glob.glob("/etc/nginx/conf.d/*.d/*.conf") + for f in nginx_conf_files: + # Replace the socket prefix if it's found + c = "sed -i -e 's@{}@{}@g' {}".format(PHP7_SOCKETS_PREFIX, PHP5_SOCKETS_PREFIX, f) + os.system(c) + + # Reload nginx + _run_service_command("reload", "nginx")