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

👌 Improved PHP version filter

This commit is contained in:
2021-04-01 20:19:55 +02:00
parent 340c36fdf8
commit 5d423210dd
2 changed files with 15 additions and 5 deletions

View File

@ -605,7 +605,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = "3.3-prerelease4";
MARKETING_VERSION = 3.3;
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@ -629,7 +629,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = "3.3-prerelease4";
MARKETING_VERSION = 3.3;
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";

View File

@ -24,10 +24,18 @@ class Actions {
// Get a list of versions only
var versionsOnly : [String] = []
versions.forEach { (string) in
versions.filter { (version) -> Bool in
// Omit everything that doesn't start with php@
// (e.g. something-php@8.0 won't be detected)
return version.starts(with: "php@")
}.forEach { (string) in
let version = string.components(separatedBy: "php@")[1]
// Only append the version if it doesn't already exist (avoid dupes)
if !versionsOnly.contains(version) && Constants.SupportedPhpVersions.contains(version) {
// Only append the version if it doesn't already exist (avoid dupes),
// is supported and where the binary exists (avoids broken installs)
if !versionsOnly.contains(version)
&& Constants.SupportedPhpVersions.contains(version)
&& Shell.fileExists("\(Paths.optPath)/php@\(version)/bin/php")
{
versionsOnly.append(version)
}
}
@ -42,6 +50,8 @@ class Actions {
versionsOnly.append(phpAlias);
}
print("The PHP versions that were detected are: \(versionsOnly)")
return versionsOnly
}