1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-07 03:50:08 +02:00

👌 Disallow installation of linked PHP

This commit is contained in:
2023-03-24 00:40:53 +01:00
parent b456fdc65c
commit 6b72d4da65
2 changed files with 15 additions and 2 deletions

View File

@ -170,12 +170,22 @@ struct PhpFormulaeView: View {
description: "phpman.failures.install.desc".localized(
"brew install \(formula)"
),
button: "generic.ok"
button: "generic.ok".localized
)
}
}
public func uninstall(_ formula: BrewFormula) async {
// Disallow removal of the currently active versipn
if formula.installedVersion == PhpEnv.shared.currentInstall?.version.text {
self.presentErrorAlert(
title: "phpman.uninstall_prevented.title".localized,
description: "phpman.uninstall_prevented.desc".localized,
button: "generic.ok".localized
)
return
}
let command = RemovePhpVersionCommand(formula: formula.name)
do {
@ -199,7 +209,7 @@ struct PhpFormulaeView: View {
description: "phpman.failures.uninstall.desc".localized(
"brew uninstall \(formula) --force"
),
button: "generic.ok"
button: "generic.ok".localized
)
}
}

View File

@ -99,6 +99,9 @@
"phpman.failures.install.title" = "Install failed!";
"phpman.failures.install.desc" = "Unfortunately, the automatic installation failed. You can manually try to run this command: `%@` and find out what goes wrong. Remember to restart PHP Monitor (or press the refresh button) when this is done.";
"phpman.uninstall_prevented.title" = "You cannot uninstall the currently active version of PHP via PHP Monitor.";
"phpman.uninstall_prevented.desc" = "In order to prevent issues with PHP Monitor and further crashes, it isn't possible to uninstall the currently linked version of PHP via this UI. You can switch versions and try again, or uninstall this version manually via the terminal.\n\nPlease note that PHP Monitor may crash if you uninstall the currently linked PHP version.";
"phpman.failures.uninstall.title" = "Uninstall failed!";
"phpman.failures.uninstall.desc" = "Unfortunately, the automatic uninstallation failed. You can manually try to run this command: `%@` and find out what goes wrong. Remember to restart PHP Monitor (or press the refresh button) when this is done.";