mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-07 03:50:08 +02:00
🏗 Health check in UI
This commit is contained in:
@ -45,7 +45,9 @@ class PhpInstallation {
|
||||
withStandardError: true
|
||||
).trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
|
||||
if testCommand.contains("Library not loaded") {
|
||||
// If the "dyld: Library not loaded" issue pops up, we have an unhealthy PHP installation
|
||||
// and we will need to reinstall this version of PHP via Homebrew.
|
||||
if testCommand.contains("Library not loaded") && testCommand.contains("dyld") {
|
||||
self.isHealthy = false
|
||||
Log.err("The PHP installation of \(self.versionNumber.short) is not healthy!")
|
||||
}
|
||||
|
@ -39,8 +39,19 @@ struct BrewFormula {
|
||||
return "\(Paths.optPath)/\(resolved)/bin"
|
||||
}
|
||||
|
||||
public func isHealthy() -> Bool {
|
||||
return true
|
||||
// #error("This must check if the PHP version works")
|
||||
var shortVersion: String? {
|
||||
guard let version = self.installedVersion else {
|
||||
return nil
|
||||
}
|
||||
|
||||
return VersionNumber.make(from: version)?.short ?? nil
|
||||
}
|
||||
|
||||
public func isHealthy() -> Bool? {
|
||||
guard let shortVersion = self.shortVersion else {
|
||||
return nil
|
||||
}
|
||||
|
||||
return PhpEnv.shared.cachedPhpInstallations[shortVersion]?.isHealthy ?? nil
|
||||
}
|
||||
}
|
||||
|
@ -133,7 +133,14 @@ struct PhpFormulaeView: View {
|
||||
.padding(.horizontal, 5)
|
||||
VStack(alignment: .leading) {
|
||||
Text(formula.displayName).bold()
|
||||
// Text(formula.homebrewFolder)
|
||||
|
||||
if formula.isHealthy() == nil {
|
||||
Text("Unknown health")
|
||||
} else {
|
||||
Text(formula.isHealthy()! ? "Health OK" : "Broken!")
|
||||
}
|
||||
|
||||
Text(formula.homebrewFolder)
|
||||
|
||||
if formula.isInstalled && formula.hasUpgrade {
|
||||
Text("\(formula.installedVersion!) installed, \(formula.upgradeVersion!) available.")
|
||||
|
Reference in New Issue
Block a user