1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-11-07 05:10:06 +01:00

🏗 WIP: Ensure unsupported PHP can be removed

This commit is contained in:
2023-03-13 21:21:29 +01:00
parent 6dabcd7668
commit 862add8512

View File

@@ -154,11 +154,15 @@ public class PhpVersionInstaller {
var operations: [(version: String, action: PhpInstallAction)] = [] var operations: [(version: String, action: PhpInstallAction)] = []
let installed = PhpEnv.shared.cachedPhpInstallations.keys let installed = PhpEnv.shared.cachedPhpInstallations.keys
let unsupported = PhpEnv.shared.incompatiblePhpVersions
for installable in installables.keys { for installable in installables.keys {
// While technically possible to uninstall the main formula (`php`) // While technically possible to uninstall the main formula (`php`)
// this should be disabled in the UI... this data should be correct though // this should be disabled in the UI... this data should be correct though
operations.append((installable, installed.contains(installable) ? .remove : .install)) let availableOperation: PhpInstallAction =
installed.contains(installable) || unsupported.contains(installable) ? .remove : .install
operations.append((version: installable, action: availableOperation))
} }
operations.sort { $1.version < $0.version } operations.sort { $1.version < $0.version }