diff --git a/PHP Monitor.xcodeproj/project.pbxproj b/PHP Monitor.xcodeproj/project.pbxproj index 22958eb..5a2b9f2 100644 --- a/PHP Monitor.xcodeproj/project.pbxproj +++ b/PHP Monitor.xcodeproj/project.pbxproj @@ -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; diff --git a/phpmon/Common/Core/Actions.swift b/phpmon/Common/Core/Actions.swift index 8346655..8d9f3fe 100644 --- a/phpmon/Common/Core/Actions.swift +++ b/phpmon/Common/Core/Actions.swift @@ -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() + }) } } diff --git a/phpmon/Domain/Menu/MainMenu+FixMyValet.swift b/phpmon/Domain/Menu/MainMenu+FixMyValet.swift index cf1c532..c1e1067 100644 --- a/phpmon/Domain/Menu/MainMenu+FixMyValet.swift +++ b/phpmon/Domain/Menu/MainMenu+FixMyValet.swift @@ -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) + } } } }