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

👌 Calling detectPhpVersions always immediately caches the info

This commit is contained in:
2021-11-25 18:49:14 +01:00
parent 2d6ca0f841
commit 52606aae8b
2 changed files with 7 additions and 4 deletions

View File

@ -29,6 +29,9 @@ class Actions {
print("The PHP versions that were detected are: \(versionsOnly)")
App.shared.availablePhpVersions = versionsOnly
Actions.extractPhpLongVersions()
return versionsOnly
}
@ -36,7 +39,7 @@ class Actions {
This method extracts the PHP full version number after finding the php installation folders.
To be refactored at some later point, I'd like to cache the `PhpInstallation` objects instead of just the version number at some point.
*/
public static func extractPhpLongVersions() -> [String: String]
public static func extractPhpLongVersions()
{
var mappedVersions: [String: String] = [:]
App.shared.availablePhpVersions.forEach { version in
@ -50,7 +53,8 @@ class Actions {
}
mappedVersions[version] = longVersion
}
return mappedVersions
App.shared.cachedPhpVersionNumbers = mappedVersions
}
/**

View File

@ -41,8 +41,7 @@ class MainMenu: NSObject, NSWindowDelegate, NSMenuDelegate {
When the environment is all clear and the app can run, let's go.
*/
private func onEnvironmentPass() {
App.shared.availablePhpVersions = Actions.detectPhpVersions()
App.shared.cachedPhpVersionNumbers = Actions.extractPhpLongVersions()
_ = Actions.detectPhpVersions()
updatePhpVersionInStatusBar()
let installation = App.phpInstall!