mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-07 12:00:09 +02:00
👌 Improve global composer check
This commit is contained in:
@ -201,7 +201,6 @@ class Startup {
|
||||
// =================================================================================
|
||||
// Determine that Valet works correctly (no issues in platform detected)
|
||||
// =================================================================================
|
||||
/*
|
||||
EnvironmentCheck(
|
||||
command: {
|
||||
return valet("--version", sudo: false)
|
||||
@ -212,7 +211,6 @@ class Startup {
|
||||
subtitleText: "startup.errors.global_composer_platform_issues.subtitle".localized,
|
||||
descriptionText: "startup.errors.global_composer_platform_issues.desc".localized
|
||||
),
|
||||
*/
|
||||
// =================================================================================
|
||||
// Determine the Valet version and ensure it isn't unknown.
|
||||
// =================================================================================
|
||||
|
@ -44,10 +44,7 @@ extension MainMenu {
|
||||
}
|
||||
|
||||
// Check if Valet still works correctly
|
||||
if Valet.shared.hasPlatformIssues() {
|
||||
Log.info("Composer platform issue(s) detected.")
|
||||
self.suggestFixMyComposer()
|
||||
}
|
||||
self.checkForPlatformIssues()
|
||||
|
||||
// Update stats
|
||||
Stats.incrementSuccessfulSwitchCount()
|
||||
@ -55,6 +52,13 @@ extension MainMenu {
|
||||
}
|
||||
}
|
||||
|
||||
private func checkForPlatformIssues() {
|
||||
if Valet.shared.hasPlatformIssues() {
|
||||
Log.info("Composer platform issue(s) detected.")
|
||||
self.suggestFixMyComposer()
|
||||
}
|
||||
}
|
||||
|
||||
private func suggestFixMyValet(failed version: String) {
|
||||
let outcome = BetterAlert()
|
||||
.withInformation(
|
||||
@ -78,7 +82,12 @@ extension MainMenu {
|
||||
)
|
||||
.withPrimary(text: "alert.global_composer_platform_issues.buttons.update".localized, action: { alert in
|
||||
alert.close(with: .OK)
|
||||
self.updateGlobalComposerDependencies()
|
||||
ComposerWindow().updateGlobalDependencies(
|
||||
notify: true,
|
||||
completion: { _ in
|
||||
self.checkForPlatformIssues()
|
||||
}
|
||||
)
|
||||
})
|
||||
.withSecondary(text: "", action: nil)
|
||||
.withTertiary(text: "alert.global_composer_platform_issues.buttons.quit".localized, action: { alert in
|
||||
|
@ -258,7 +258,7 @@
|
||||
"prefs.notify_about_secure_status_desc" = "Displays a notification when a domain has been secured or unsecured.";
|
||||
"prefs.notify_about_secure_status" = "Notify about secure/unsecure status";
|
||||
|
||||
"prefs.notify_about_composer_success_desc" = "Displays a notification when the global composer configuration was successfully updated.";
|
||||
"prefs.notify_about_composer_success_desc" = "Displays a notification when the global Composer configuration was successfully updated.";
|
||||
"prefs.notify_about_composer_success" = "Notify about global composer update";
|
||||
|
||||
// NOTIFICATIONS
|
||||
@ -391,7 +391,7 @@ You can do this by running `composer global update` in your terminal. After that
|
||||
// Composer issues
|
||||
"alert.global_composer_platform_issues.title" = "Composer detected issues in your platform";
|
||||
"alert.global_composer_platform_issues.subtitle" = "The version of PHP you switched to is too old for the global Composer dependencies you have installed. These dependencies will need to be updated.";
|
||||
"alert.global_composer_platform_issues.desc" = "The easiest way to prevent this issue from occurring in the future is to switch to the oldest PHP version you have installed and to run `composer global update` again. \n\nAlternatively, you can choose the 'Automatically update global dependencies' option in Preferences to avoid this issue as well.";
|
||||
"alert.global_composer_platform_issues.desc" = "The easiest way to prevent this issue from occurring in the future is to switch to the oldest PHP version you have installed and to run `composer global update` again. \n\nAlternatively, you can choose the 'Automatically update global dependencies' option in Preferences to avoid this issue as well.\n\nIf you keep seeing this message even after attempting to update those global dependencies, you may wish to look at your global composer configuration file, located in `~/.composer/composer.json`.";
|
||||
"alert.global_composer_platform_issues.buttons.update" = "Update Global Dependencies";
|
||||
"alert.global_composer_platform_issues.buttons.quit" = "Quit PHP Monitor";
|
||||
|
||||
@ -448,7 +448,7 @@ You can do this by running `composer global update` in your terminal. After that
|
||||
/// Platform issue detected
|
||||
"startup.errors.global_composer_platform_issues.title" = "Composer detected issues in your platform";
|
||||
"startup.errors.global_composer_platform_issues.subtitle" = "You will have to run `composer global update`. The easiest way to prevent this issue from occurring in the future is to:\n\n1. Run `composer global update`.\n2. Restart PHP Monitor. It should work again!\n3. Switch to the oldest PHP version you have installed.\n4. Run `composer global update` again (via the Terminal or via PHP Monitor).";
|
||||
"startup.errors.global_composer_platform_issues.desc" = "Alternatively, you can go to Preferences and check the 'Automatically update global dependencies' option. This will update your global Composer dependencies whenever you change PHP versions, so this may not be ideal if you may not have constant access to the internet.";
|
||||
"startup.errors.global_composer_platform_issues.desc" = "Alternatively, you can go to Preferences and check the 'Automatically update global dependencies' option. This will update your global Composer dependencies whenever you change PHP versions, so this may not be ideal if you may not have constant access to the internet.\n\nTo find out what's going wrong, try running `valet --version`. (Valet is currently not functional with the currently installed dependencies.)";
|
||||
|
||||
/// Cannot retrieve services
|
||||
"startup.errors.services_json_error.title" = "Cannot determine services status";
|
||||
|
Reference in New Issue
Block a user