diff --git a/phpmon/Common/Core/Actions.swift b/phpmon/Common/Core/Actions.swift index 8a5b5b1..055d90e 100644 --- a/phpmon/Common/Core/Actions.swift +++ b/phpmon/Common/Core/Actions.swift @@ -20,6 +20,11 @@ class Actions { await brew("services restart \(HomebrewFormulae.php)", sudo: HomebrewFormulae.php.elevated) } + public static func restartPhpFpm(version: String) async { + let formula = (version == PhpEnvironments.brewPhpAlias) ? "php" : "php@\(version)" + await brew("services restart \(formula)", sudo: HomebrewFormulae.php.elevated) + } + public static func restartNginx() async { await brew("services restart \(HomebrewFormulae.nginx)", sudo: HomebrewFormulae.nginx.elevated) } diff --git a/phpmon/Domain/Integrations/Homebrew/Commands/PHP Extensions/InstallPhpExtensionCommand.swift b/phpmon/Domain/Integrations/Homebrew/Commands/PHP Extensions/InstallPhpExtensionCommand.swift index d959719..09e965e 100644 --- a/phpmon/Domain/Integrations/Homebrew/Commands/PHP Extensions/InstallPhpExtensionCommand.swift +++ b/phpmon/Domain/Integrations/Homebrew/Commands/PHP Extensions/InstallPhpExtensionCommand.swift @@ -61,6 +61,11 @@ class InstallPhpExtensionCommand: BrewCommand { // Reload and restart PHP versions onProgress(.create(value: 0.95, title: self.getCommandTitle(), description: "phpman.steps.reloading".localized)) + // Restart PHP-FPM + if let installed = self.installing.first { + await Actions.restartPhpFpm(version: installed.phpVersion) + } + // Check which version of PHP are now installed await PhpEnvironments.detectPhpVersions() diff --git a/phpmon/Domain/Integrations/Homebrew/Commands/PHP Extensions/RemovePhpExtensionCommand.swift b/phpmon/Domain/Integrations/Homebrew/Commands/PHP Extensions/RemovePhpExtensionCommand.swift index 2afa94d..f81c88a 100644 --- a/phpmon/Domain/Integrations/Homebrew/Commands/PHP Extensions/RemovePhpExtensionCommand.swift +++ b/phpmon/Domain/Integrations/Homebrew/Commands/PHP Extensions/RemovePhpExtensionCommand.swift @@ -61,6 +61,8 @@ class RemovePhpExtensionCommand: BrewCommand { await PhpEnvironments.detectPhpVersions() + await Actions.restartPhpFpm(version: phpExtension.phpVersion) + await MainMenu.shared.refreshActiveInstallation() onProgress(.create(value: 1, title: getCommandTitle(), description: "phpman.steps.success".localized))