mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-10 05:00:06 +02:00
👌 Calling detectPhpVersions
always immediately caches the info
This commit is contained in:
@@ -29,6 +29,9 @@ class Actions {
|
|||||||
|
|
||||||
print("The PHP versions that were detected are: \(versionsOnly)")
|
print("The PHP versions that were detected are: \(versionsOnly)")
|
||||||
|
|
||||||
|
App.shared.availablePhpVersions = versionsOnly
|
||||||
|
Actions.extractPhpLongVersions()
|
||||||
|
|
||||||
return versionsOnly
|
return versionsOnly
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,7 +39,7 @@ class Actions {
|
|||||||
This method extracts the PHP full version number after finding the php installation folders.
|
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.
|
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] = [:]
|
var mappedVersions: [String: String] = [:]
|
||||||
App.shared.availablePhpVersions.forEach { version in
|
App.shared.availablePhpVersions.forEach { version in
|
||||||
@@ -50,7 +53,8 @@ class Actions {
|
|||||||
}
|
}
|
||||||
mappedVersions[version] = longVersion
|
mappedVersions[version] = longVersion
|
||||||
}
|
}
|
||||||
return mappedVersions
|
|
||||||
|
App.shared.cachedPhpVersionNumbers = mappedVersions
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -41,8 +41,7 @@ class MainMenu: NSObject, NSWindowDelegate, NSMenuDelegate {
|
|||||||
When the environment is all clear and the app can run, let's go.
|
When the environment is all clear and the app can run, let's go.
|
||||||
*/
|
*/
|
||||||
private func onEnvironmentPass() {
|
private func onEnvironmentPass() {
|
||||||
App.shared.availablePhpVersions = Actions.detectPhpVersions()
|
_ = Actions.detectPhpVersions()
|
||||||
App.shared.cachedPhpVersionNumbers = Actions.extractPhpLongVersions()
|
|
||||||
updatePhpVersionInStatusBar()
|
updatePhpVersionInStatusBar()
|
||||||
|
|
||||||
let installation = App.phpInstall!
|
let installation = App.phpInstall!
|
||||||
|
Reference in New Issue
Block a user