mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-06 19:40:08 +02:00
✨ Check cutoff date for PHP version management
This commit is contained in:
@ -18,6 +18,20 @@ struct Constants {
|
||||
*/
|
||||
static let MinimumRecommendedValetVersion = "2.16.2"
|
||||
|
||||
/**
|
||||
PHP Monitor supplies a hardcoded list of PHP packages in its own
|
||||
PHP Version Manager.
|
||||
|
||||
This hardcoded list will expire and will need to be modified when
|
||||
the cutoff date occurs, which is when the `php` formula will
|
||||
become PHP 8.4, and a new build will need to be made.
|
||||
|
||||
If users launch an older version of the app, then a warning
|
||||
will be displayed to let them know that certain operations
|
||||
will not work correctly and that they need to update their app.
|
||||
*/
|
||||
static let PhpFormulaeCutoffDate = "2024-11-01"
|
||||
|
||||
/**
|
||||
* The PHP versions that are considered pre-release versions.
|
||||
* Past a certain date, an experimental version "graduates"
|
||||
@ -25,8 +39,7 @@ struct Constants {
|
||||
*/
|
||||
static var ExperimentalPhpVersions: Set<String> {
|
||||
let releaseDates = [
|
||||
"8.4": Date.fromString("2024-12-01"), // PLACEHOLDER DATE
|
||||
"8.3": Date.fromString("2023-11-23") // OFFICIAL RELEASE
|
||||
"8.4": Date.fromString("2024-12-01") // PLACEHOLDER DATE
|
||||
]
|
||||
|
||||
return Set(releaseDates
|
||||
@ -48,8 +61,7 @@ struct Constants {
|
||||
static let DetectedPhpVersions: Set = [
|
||||
"5.6",
|
||||
"7.0", "7.1", "7.2", "7.3", "7.4",
|
||||
"8.0", "8.1", "8.2",
|
||||
"8.3",
|
||||
"8.0", "8.1", "8.2", "8.3",
|
||||
"8.4"
|
||||
]
|
||||
|
||||
|
@ -21,6 +21,10 @@ struct BrewPhpFormula: Equatable {
|
||||
/// The upgrade that is currently available, if it exists.
|
||||
let upgradeVersion: String?
|
||||
|
||||
#warning("The rebuild attribute should be checked, it can be used to check if a Tap update exists for a pre-release version.")
|
||||
/// A rebuild version, if applicable.
|
||||
// let rebuild: String?
|
||||
|
||||
/// Whether this formula is a stable version of PHP.
|
||||
let prerelease: Bool
|
||||
|
||||
|
@ -33,28 +33,8 @@ struct PhpExtensionManagerView: View {
|
||||
VStack(spacing: 0) {
|
||||
header.padding(20)
|
||||
|
||||
if PhpEnvironments.shared.availablePhpVersions.count <= 4 {
|
||||
Picker("Show extensions for: ",
|
||||
selection: $manager.phpVersion) {
|
||||
ForEach(PhpEnvironments.shared.availablePhpVersions, id: \.self) {
|
||||
Text("PHP \($0)")
|
||||
.tag($0)
|
||||
.font(.system(size: 12))
|
||||
}
|
||||
}
|
||||
.pickerStyle(SegmentedPickerStyle()).padding(15)
|
||||
.font(.system(size: 12))
|
||||
} else {
|
||||
Picker("Show extensions for: ",
|
||||
selection: $manager.phpVersion) {
|
||||
ForEach(PhpEnvironments.shared.availablePhpVersions, id: \.self) {
|
||||
Text("PHP \($0)")
|
||||
.tag($0)
|
||||
.font(.system(size: 12))
|
||||
}
|
||||
}
|
||||
.pickerStyle(MenuPickerStyle()).padding(15)
|
||||
.font(.system(size: 12))
|
||||
if PhpEnvironments.shared.availablePhpVersions.count > 1 {
|
||||
phpVersionPicker.disabled(self.status.busy)
|
||||
}
|
||||
|
||||
VStack {
|
||||
@ -86,6 +66,35 @@ struct PhpExtensionManagerView: View {
|
||||
|
||||
// MARK: View Variables
|
||||
|
||||
private var phpVersionPicker: some View {
|
||||
Group {
|
||||
if PhpEnvironments.shared.availablePhpVersions.count <= 4 {
|
||||
Picker("Show extensions for: ",
|
||||
selection: $manager.phpVersion) {
|
||||
ForEach(PhpEnvironments.shared.availablePhpVersions, id: \.self) {
|
||||
Text("PHP \($0)")
|
||||
.tag($0)
|
||||
.font(.system(size: 12))
|
||||
}
|
||||
}
|
||||
.pickerStyle(SegmentedPickerStyle()).padding(15)
|
||||
.font(.system(size: 12))
|
||||
} else {
|
||||
Picker("Show extensions for: ",
|
||||
selection: $manager.phpVersion) {
|
||||
ForEach(PhpEnvironments.shared.availablePhpVersions, id: \.self) {
|
||||
Text("PHP \($0)")
|
||||
.tag($0)
|
||||
.font(.system(size: 12))
|
||||
}
|
||||
}
|
||||
.pickerStyle(MenuPickerStyle()).padding(15)
|
||||
.font(.system(size: 12))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private var header: some View {
|
||||
HStack(alignment: .center, spacing: 15) {
|
||||
Image(systemName: "puzzlepiece.extension.fill")
|
||||
|
@ -48,6 +48,7 @@ struct PhpVersionManagerView: View {
|
||||
|
||||
await delay(seconds: 1)
|
||||
|
||||
// PHP formulae may not be installable with older Homebrew version
|
||||
if version.major != 4 {
|
||||
Task { @MainActor in
|
||||
self.presentErrorAlert(
|
||||
@ -59,6 +60,16 @@ struct PhpVersionManagerView: View {
|
||||
}
|
||||
}
|
||||
|
||||
// PHP formulae may be out of date past the cutoff date
|
||||
if Date.fromString(Constants.PhpFormulaeCutoffDate)! < Date.now {
|
||||
self.presentErrorAlert(
|
||||
title: "phpman.warnings.outdated.title".localized,
|
||||
description: "phpman.warnings.outdated.desc".localized(version.text),
|
||||
button: "generic.ok".localized,
|
||||
style: .warning
|
||||
)
|
||||
}
|
||||
|
||||
await PhpEnvironments.detectPhpVersions()
|
||||
await self.handler.refreshPhpVersions(loadOutdated: false)
|
||||
await self.handler.refreshPhpVersions(loadOutdated: true)
|
||||
|
@ -146,6 +146,9 @@
|
||||
"phpman.has_updates.description" = "One or more updates are available. (Please note that PHP Monitor will always install or update PHP versions in bulk, so you will always upgrade all installations at once.)";
|
||||
"phpman.has_updates.button" = "Upgrade All";
|
||||
|
||||
"phpman.warnings.outdated.title" = "This version of PHP Monitor is outdated";
|
||||
"phpman.warnings.outdated.desc" = "It is highly likely that the Homebrew formulae have changed since this version of PHP Monitor was created. I highly recommend updating the application before using the version manager to install, remove or upgrade PHP versions.";
|
||||
|
||||
"phpman.warnings.unsupported.title" = "Your version of Homebrew may cause issues";
|
||||
"phpman.warnings.unsupported.desc" = "No functionality is disabled, but some commands may not work as expected. You are currently running Homebrew %@.
|
||||
|
||||
|
Reference in New Issue
Block a user