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

👌 Rename "Force Load PHP" to "Fix My Valet" (#111)

This commit is contained in:
2022-01-31 12:40:00 +01:00
parent 813aec2b42
commit 4cffe5a662
4 changed files with 39 additions and 28 deletions

View File

@@ -88,7 +88,7 @@ class Actions {
return URL(string: "file:///private/tmp/phpmon_phpinfo.html")! return URL(string: "file:///private/tmp/phpmon_phpinfo.html")!
} }
// MARK: - Quick Fix // MARK: - Fix My Valet
/** /**
Detects all currently available PHP versions, Detects all currently available PHP versions,
@@ -100,7 +100,7 @@ class Actions {
If this does not solve the issue, the user may need to install additional If this does not solve the issue, the user may need to install additional
extensions and/or run `composer global update`. extensions and/or run `composer global update`.
*/ */
public static func fixMyPhp() public static func fixMyValet()
{ {
brew("services restart dnsmasq", sudo: true) brew("services restart dnsmasq", sudo: true)

View File

@@ -234,21 +234,26 @@ class MainMenu: NSObject, NSWindowDelegate, NSMenuDelegate {
} }
} }
@objc func forceRestartLatestPhp() { @objc func fixMyValet() {
// Tell the user the switch is about to occur // Tell the user the switch is about to occur
Alert.notify( if Alert.present(
message: "alert.force_reload.title".localized, messageText: "alert.fix_my_valet.title".localized,
info: "alert.force_reload.info".localized informativeText: "alert.fix_my_valet.info".localized(PhpEnv.brewPhpVersion),
) buttonTitle: "alert.fix_my_valet.ok".localized,
secondButtonTitle: "alert.fix_my_valet.cancel".localized,
// Start switching style: .warning
waitAndExecute { ) {
Actions.fixMyPhp() // Start the fix
} completion: { waitAndExecute {
Alert.notify( Actions.fixMyValet()
message: "alert.force_reload_done.title".localized, } completion: {
info: "alert.force_reload_done.info".localized Alert.notify(
) message: "alert.fix_my_valet_done.title".localized,
info: "alert.fix_my_valet_done.info".localized
)
}
} else {
Log.info("The user has chosen to abort Fix My Valet")
} }
} }

View File

@@ -45,13 +45,13 @@ class StatusMenu : NSMenu {
if !PhpEnv.shared.availablePhpVersions.contains(PhpEnv.brewPhpVersion) { if !PhpEnv.shared.availablePhpVersions.contains(PhpEnv.brewPhpVersion) {
servicesMenu.addItem(NSMenuItem( servicesMenu.addItem(NSMenuItem(
title: "mi_force_load_latest_unavailable".localized(PhpEnv.brewPhpVersion), title: "mi_fix_my_valet_unavailable".localized(PhpEnv.brewPhpVersion),
action: nil, keyEquivalent: "f" action: nil, keyEquivalent: "f"
)) ))
} else { } else {
servicesMenu.addItem(NSMenuItem( servicesMenu.addItem(NSMenuItem(
title: "mi_force_load_latest".localized(PhpEnv.brewPhpVersion), title: "mi_fix_my_valet".localized(PhpEnv.brewPhpVersion),
action: #selector(MainMenu.forceRestartLatestPhp), keyEquivalent: "f")) action: #selector(MainMenu.fixMyValet), keyEquivalent: "f"))
} }
servicesMenu.addItem(NSMenuItem(title: "mi_services".localized, action: nil, keyEquivalent: "")) servicesMenu.addItem(NSMenuItem(title: "mi_services".localized, action: nil, keyEquivalent: ""))
@@ -95,7 +95,11 @@ class StatusMenu : NSMenu {
self.addItem(NSMenuItem.separator()) self.addItem(NSMenuItem.separator())
self.addItem(HeaderView.asMenuItem(text: "mi_composer".localized)) self.addItem(HeaderView.asMenuItem(text: "mi_composer".localized))
self.addItem(NSMenuItem(title: "mi_global_composer".localized, action: #selector(MainMenu.openGlobalComposerFolder), keyEquivalent: "g")) self.addItem(NSMenuItem(title: "mi_global_composer".localized, action: #selector(MainMenu.openGlobalComposerFolder), keyEquivalent: "g"))
self.addItem(NSMenuItem(title: "mi_update_global_composer".localized, action: PhpEnv.shared.isBusy ? nil : #selector(MainMenu.updateGlobalComposerDependencies), keyEquivalent: ""))
let composerMenuItem = NSMenuItem(title: "mi_update_global_composer".localized, action: PhpEnv.shared.isBusy ? nil : #selector(MainMenu.updateGlobalComposerDependencies), keyEquivalent: "g")
composerMenuItem.keyEquivalentModifierMask = .shift
self.addItem(composerMenuItem)
if (PhpEnv.shared.isBusy) { if (PhpEnv.shared.isBusy) {
return return

View File

@@ -25,8 +25,8 @@
"mi_manage_services" = "Manage Services"; "mi_manage_services" = "Manage Services";
"mi_restart_all_services" = "Restart All Services"; "mi_restart_all_services" = "Restart All Services";
"mi_stop_all_services" = "Stop All Services"; "mi_stop_all_services" = "Stop All Services";
"mi_force_load_latest" = "Force Load (Latest) PHP %@"; "mi_fix_my_valet" = "Fix My Valet (PHP & Services)";
"mi_force_load_latest_unavailable" = "Force Load Unavailable (PHP %@ Not Installed)"; "mi_fix_my_valet_unavailable" = "Fix My Valet Unavailable";
"mi_php_refresh" = "Refresh Information"; "mi_php_refresh" = "Refresh Information";
"mi_configuration" = "PHP Configuration"; "mi_configuration" = "PHP Configuration";
@@ -191,13 +191,15 @@ problem manually, using your own Terminal app (this just shows you the output)."
"alert.composer_php_requirement.title" = "`%@` has the following PHP requirement: \"php\":\n\"%@\"."; "alert.composer_php_requirement.title" = "`%@` has the following PHP requirement: \"php\":\n\"%@\".";
"alert.composer_php_requirement.info" = "This required PHP version was determined by checking the `%@` field in the `composer.json` file when the site list was last refreshed."; "alert.composer_php_requirement.info" = "This required PHP version was determined by checking the `%@` field in the `composer.json` file when the site list was last refreshed.";
// Force Reload Started // Fix My Valet Started
"alert.force_reload.title" = "PHP Monitor will force reload the latest version of PHP"; "alert.fix_my_valet.title" = "Having issues? Fix My Valet is ready to commence!";
"alert.force_reload.info" = "This can take a while. You'll get another alert when the force reload has completed."; "alert.fix_my_valet.info" = "This can take a while. Please be patient.\n\nWhen this is done, all other services will be halted and PHP %@ will be linked. You will be able to switch to your desired version of PHP once this operation has completed.\n\n(You'll get another alert once Fix My Valet is done.)";
"alert.fix_my_valet.ok" = "Continue";
"alert.fix_my_valet.cancel" = "Abort";
// Force Reload Done // Fix My Valet Done
"alert.force_reload_done.title" = "PHP has been force reloaded"; "alert.fix_my_valet_done.title" = "Fix My Valet has completed its operations.";
"alert.force_reload_done.info" = "All appropriate services have been stopped and the correct ones restarted, and the latest version of PHP should now be active. You can now try switching to another version of PHP.\n\nIf visiting sites still does not work, you may try running `valet install` again, this can fix a 502 issue (Bad Gateway)."; "alert.fix_my_valet_done.info" = "All appropriate services have been stopped and the correct ones restarted, and the latest version of PHP should now be active. You can now try switching to another version of PHP.\n\nIf visiting sites still does not work, you may try running `valet install` again, this can fix a 502 issue (Bad Gateway).\n\nIf Valet is broken and you cannot run `valet install`, you may need to run `composer global update`. Please consult the FAQ on GitHub if you have further issues.";
// PHP FPM Broken // PHP FPM Broken
"alert.php_fpm_broken.title" = "PHP-FPM configuration is incorrect"; "alert.php_fpm_broken.title" = "PHP-FPM configuration is incorrect";