1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-06 19:40:08 +02:00

🐛 Restart PHP-FPM after managing extensions

This is done to prevent issues like #292.
This commit is contained in:
2024-06-28 11:37:01 +02:00
parent 652878d97f
commit a3226b632f
3 changed files with 12 additions and 0 deletions

View File

@ -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)
}

View File

@ -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()

View File

@ -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))