mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-08 04:20:07 +02:00
🏗 Conditional PHP 5.6 support
This commit is contained in:
@ -124,6 +124,12 @@ class PhpEnv {
|
||||
) -> [String] {
|
||||
var output : [String] = []
|
||||
|
||||
var supported = Constants.SupportedPhpVersions
|
||||
|
||||
if !Valet.enabled(feature: .supportForPhp56) {
|
||||
supported.removeAll { $0 == "5.6" }
|
||||
}
|
||||
|
||||
versions.filter { (version) -> Bool in
|
||||
// Omit everything that doesn't start with php@
|
||||
// (e.g. something-php@8.0 won't be detected)
|
||||
@ -133,7 +139,7 @@ class PhpEnv {
|
||||
// Only append the version if it doesn't already exist (avoid dupes),
|
||||
// is supported and where the binary exists (avoids broken installs)
|
||||
if !output.contains(version)
|
||||
&& Constants.SupportedPhpVersions.contains(version)
|
||||
&& supported.contains(version)
|
||||
&& (checkBinaries ? Filesystem.fileExists("\(Paths.optPath)/php@\(version)/bin/php") : true)
|
||||
{
|
||||
output.append(version)
|
||||
|
@ -11,7 +11,8 @@ import Foundation
|
||||
class Valet {
|
||||
|
||||
enum FeatureFlag {
|
||||
case isolatedSites
|
||||
case isolatedSites,
|
||||
supportForPhp56
|
||||
}
|
||||
|
||||
static let shared = Valet()
|
||||
@ -37,6 +38,13 @@ class Valet {
|
||||
self.sites = []
|
||||
}
|
||||
|
||||
/**
|
||||
Check if a particular feature is enabled.
|
||||
*/
|
||||
public static func enabled(feature: FeatureFlag) -> Bool {
|
||||
return self.shared.features.contains(feature)
|
||||
}
|
||||
|
||||
/**
|
||||
We don't want to load the initial config.json file as soon as the class is initialised.
|
||||
Instead, we'll defer the loading of the configuration file once the initial app checks
|
||||
@ -91,9 +99,11 @@ class Valet {
|
||||
*/
|
||||
public func validateVersion() -> Void {
|
||||
if version.versionCompare("3.0") == .orderedAscending {
|
||||
Log.warn("This version of Valet does not support isolation yet. Disabling isolation checks.")
|
||||
Log.info("This version of Valet does not support isolation yet. Disabling isolation checks.")
|
||||
self.features.append(.supportForPhp56)
|
||||
} else {
|
||||
self.features.append(FeatureFlag.isolatedSites)
|
||||
Log.info("This version of Valet does not support PHP 5.6.")
|
||||
self.features.append(.isolatedSites)
|
||||
}
|
||||
|
||||
if version.versionCompare(Constants.MinimumRecommendedValetVersion) == .orderedAscending {
|
||||
|
Reference in New Issue
Block a user