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

♻️ Reworked "Fix My Valet" to use built-in switcher

This commit is contained in:
2022-03-18 18:36:49 +01:00
parent 9a6975e3d9
commit d5d9b38ed6
3 changed files with 16 additions and 28 deletions

View File

@ -1302,7 +1302,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 720;
CURRENT_PROJECT_VERSION = 730;
DEBUG = YES;
DEVELOPMENT_TEAM = 8M54J5J787;
ENABLE_HARDENED_RUNTIME = YES;
@ -1328,7 +1328,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 720;
CURRENT_PROJECT_VERSION = 730;
DEBUG = NO;
DEVELOPMENT_TEAM = 8M54J5J787;
ENABLE_HARDENED_RUNTIME = YES;

View File

@ -124,25 +124,13 @@ class Actions {
If this does not solve the issue, the user may need to install additional
extensions and/or run `composer global update`.
*/
public static func fixMyValet()
public static func fixMyValet(completed: @escaping () -> Void)
{
brew("services restart dnsmasq", sudo: true)
PhpEnv.shared.detectPhpVersions().forEach { (version) in
let formula = (version == PhpEnv.brewPhpVersion) ? "php" : "php@\(version)"
brew("unlink php@\(version)")
brew("services stop \(formula)")
brew("services stop \(formula)", sudo: true)
}
brew("services stop dnsmasq")
brew("services stop php")
brew("services stop nginx")
brew("link php --overwrite --force")
brew("services restart dnsmasq", sudo: true)
brew("services restart php", sudo: true)
brew("services restart nginx", sudo: true)
InternalSwitcher().performSwitch(to: PhpEnv.brewPhpVersion, completion: {
brew("services restart dnsmasq", sudo: true)
brew("services restart php", sudo: true)
brew("services restart nginx", sudo: true)
completed()
})
}
}

View File

@ -32,13 +32,13 @@ extension MainMenu {
return
}
asyncExecution {
Actions.fixMyValet()
} success: {
if previousVersion == PhpEnv.brewPhpVersion {
self.presentAlertForSameVersion()
} else {
self.presentAlertForDifferentVersion(version: previousVersion)
Actions.fixMyValet {
DispatchQueue.main.async {
if previousVersion == PhpEnv.brewPhpVersion {
self.presentAlertForSameVersion()
} else {
self.presentAlertForDifferentVersion(version: previousVersion)
}
}
}
}