diff --git a/PHP Monitor.xcodeproj/project.pbxproj b/PHP Monitor.xcodeproj/project.pbxproj index 716f5e0..afdbd98 100644 --- a/PHP Monitor.xcodeproj/project.pbxproj +++ b/PHP Monitor.xcodeproj/project.pbxproj @@ -423,7 +423,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 29; + CURRENT_PROJECT_VERSION = 30; DEVELOPMENT_TEAM = 8M54J5J787; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = phpmon/Info.plist; @@ -447,7 +447,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 29; + CURRENT_PROJECT_VERSION = 30; DEVELOPMENT_TEAM = 8M54J5J787; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = phpmon/Info.plist; diff --git a/phpmon/Classes/Commands/Actions.swift b/phpmon/Classes/Commands/Actions.swift index e4c5f76..45413ab 100644 --- a/phpmon/Classes/Commands/Actions.swift +++ b/phpmon/Classes/Commands/Actions.swift @@ -51,6 +51,11 @@ class Actions { Shell.user.run("sudo \(Paths.brew()) services restart nginx") } + public static func restartDnsMasq() + { + Shell.user.run("sudo \(Paths.brew()) services restart dnsmasq") + } + /** Switching to a new PHP version involves: - unlinking the current version diff --git a/phpmon/Classes/Menu/StatusMenu.swift b/phpmon/Classes/Menu/StatusMenu.swift index 6676fe0..2d2828a 100644 --- a/phpmon/Classes/Menu/StatusMenu.swift +++ b/phpmon/Classes/Menu/StatusMenu.swift @@ -43,8 +43,14 @@ class StatusMenu : NSMenu { } self.addItem(NSMenuItem.separator()) self.addItem(NSMenuItem(title: "mi_active_services".localized, action: nil, keyEquivalent: "")) - self.addItem(NSMenuItem(title: "mi_restart_php_fpm".localized, action: #selector(MainMenu.restartPhpFpm), keyEquivalent: "f")) + self.addItem(NSMenuItem(title: "mi_restart_dnsmasq".localized, action: #selector(MainMenu.restartDnsMasq), keyEquivalent: "d")) + self.addItem(NSMenuItem(title: "mi_restart_php_fpm".localized, action: #selector(MainMenu.restartPhpFpm), keyEquivalent: "p")) self.addItem(NSMenuItem(title: "mi_restart_nginx".localized, action: #selector(MainMenu.restartNginx), keyEquivalent: "n")) + self.addItem(NSMenuItem(title: "mi_restart_all_services".localized, action: #selector(MainMenu.restartAllServices), keyEquivalent: "")) + + self.addItem(NSMenuItem.separator()) + self.addItem(NSMenuItem(title: "mi_diagnostics".localized, action: nil, keyEquivalent: "")) + self.addItem(NSMenuItem(title: "mi_force_load_latest".localized, action: #selector(MainMenu.forceRestartLatestPhp), keyEquivalent: "")) } if (App.shared.busy) { diff --git a/phpmon/Localizable.strings b/phpmon/Localizable.strings index ff9d974..7ecc52d 100644 --- a/phpmon/Localizable.strings +++ b/phpmon/Localizable.strings @@ -17,9 +17,12 @@ "mi_php_broken_3" = "You could also try switching to another version."; "mi_php_broken_4" = "Running `brew reinstall php` (or for the equivalent version) might help."; +"mi_diagnostics" = "Diagnostics"; "mi_active_services" = "Active Services"; -"mi_restart_php_fpm" = "Restart php-fpm service"; -"mi_restart_nginx" = "Restart nginx service"; +"mi_restart_php_fpm" = "Restart service: php"; +"mi_restart_nginx" = "Restart service: nginx"; +"mi_restart_dnsmasq" = "Restart service: dnsmasq"; +"mi_restart_all_services" = "Restart all services"; "mi_force_load_latest" = "Force load latest PHP version"; "mi_configuration" = "Configuration"; diff --git a/phpmon/Singletons/MainMenu.swift b/phpmon/Singletons/MainMenu.swift index e17a717..64c0f6d 100644 --- a/phpmon/Singletons/MainMenu.swift +++ b/phpmon/Singletons/MainMenu.swift @@ -186,12 +186,26 @@ class MainMenu: NSObject, NSWindowDelegate { }) } + @objc public func restartAllServices() { + self.waitAndExecute({ + Actions.restartDnsMasq() + Actions.restartPhpFpm() + Actions.restartNginx() + }) + } + @objc public func restartNginx() { self.waitAndExecute({ Actions.restartNginx() }) } + @objc public func restartDnsMasq() { + self.waitAndExecute({ + Actions.restartDnsMasq() + }) + } + @objc public func toggleXdebug() { self.waitAndExecute({ Actions.toggleXdebug()