Skip to content

Commit

Permalink
Prevent fixing php vendor configurations if there is no os vendor php…
Browse files Browse the repository at this point in the history
… installed
  • Loading branch information
Mikhail Sandakov committed Mar 11, 2024
1 parent 24c71f0 commit c4b012f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions actions/php.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright 1999 - 2023. Plesk International GmbH. All rights reserved.

import os
import shutil

from common import action, log, packages, php, plesk, systemd, version
Expand Down Expand Up @@ -155,7 +156,8 @@ def __init__(self):
self.name = "fix OS vendor PHP configuration"

def is_required(self) -> bool:
return super().is_required()
if os.path.exists(OS_VENDOR_PHP_FPM_CONFIG):
return True

def _prepare_action(self):
pass
Expand All @@ -164,7 +166,11 @@ def _post_action(self):
# Plesk expect www pool to be disabled by default.
# Every distro should has the same configuration generated by Plesk.
# However we store the original configuration in the www.conf.saved_by_psa file.
shutil.move(f"{OS_VENDOR_PHP_FPM_CONFIG}.rpmnew", f"{OS_VENDOR_PHP_FPM_CONFIG}.saved_by_psa")
if os.path.exists(f"{OS_VENDOR_PHP_FPM_CONFIG}.rpmnew"):
shutil.move(f"{OS_VENDOR_PHP_FPM_CONFIG}.rpmnew", f"{OS_VENDOR_PHP_FPM_CONFIG}.saved_by_psa")
elif os.path.exists(f"{OS_VENDOR_PHP_FPM_CONFIG}.rpmsave"):
shutil.move(f"{OS_VENDOR_PHP_FPM_CONFIG}", f"{OS_VENDOR_PHP_FPM_CONFIG}.saved_by_psa")
shutil.move(f"{OS_VENDOR_PHP_FPM_CONFIG}.rpmsave", f"{OS_VENDOR_PHP_FPM_CONFIG}")

if systemd.is_service_exists("php-fpm") and systemd.is_service_active("php-fpm"):
systemd.restart_services(["php-fpm"])
Expand Down

0 comments on commit c4b012f

Please sign in to comment.