mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-08 04:20:07 +02:00
👌 All methods are internal by default
This commit is contained in:
@ -19,7 +19,7 @@ class Startup {
|
||||
- Parameter success: Callback that is fired if the application can proceed with launch
|
||||
- Parameter failure: Callback that is fired if the application must retry launch
|
||||
*/
|
||||
public func checkEnvironment(success: () -> Void, failure: @escaping () -> Void)
|
||||
func checkEnvironment(success: () -> Void, failure: @escaping () -> Void)
|
||||
{
|
||||
self.failureCallback = failure
|
||||
|
||||
|
@ -12,7 +12,7 @@ struct HomebrewPackage : Decodable {
|
||||
let full_name: String
|
||||
let aliases: [String]
|
||||
|
||||
public func getVersion() -> String {
|
||||
public var version: String {
|
||||
return aliases.first!.replacingOccurrences(of: "php@", with: "")
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ class PhpExtension {
|
||||
/**
|
||||
This simply toggles the extension in the .ini file. You may need to restart the other services in order for this change to apply.
|
||||
*/
|
||||
public func toggle() {
|
||||
func toggle() {
|
||||
Actions.sed(
|
||||
file: self.file,
|
||||
original: self.line,
|
||||
|
@ -8,7 +8,7 @@
|
||||
import Cocoa
|
||||
|
||||
class StatusMenu : NSMenu {
|
||||
public func addPhpVersionMenuItems() {
|
||||
func addPhpVersionMenuItems() {
|
||||
if App.shared.currentInstall == nil {
|
||||
return
|
||||
}
|
||||
@ -24,7 +24,7 @@ class StatusMenu : NSMenu {
|
||||
self.addItem(HeaderView.asMenuItem(text: phpVersionText))
|
||||
}
|
||||
|
||||
public func addPhpActionMenuItems() {
|
||||
func addPhpActionMenuItems() {
|
||||
if App.busy {
|
||||
self.addItem(NSMenuItem(title: "mi_busy".localized, action: nil, keyEquivalent: ""))
|
||||
return
|
||||
@ -73,7 +73,7 @@ class StatusMenu : NSMenu {
|
||||
self.addItem(NSMenuItem(title: "mi_restart_all_services".localized, action: #selector(MainMenu.restartAllServices), keyEquivalent: "s"))
|
||||
}
|
||||
|
||||
public func addPhpConfigurationMenuItems() {
|
||||
func addPhpConfigurationMenuItems() {
|
||||
if App.shared.currentInstall == nil {
|
||||
return
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ class App {
|
||||
*/
|
||||
var brewPhpPackage: HomebrewPackage? = nil {
|
||||
didSet {
|
||||
self.brewPhpVersion = self.brewPhpPackage!.getVersion()
|
||||
self.brewPhpVersion = self.brewPhpPackage!.version
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ class MainMenu: NSObject, NSWindowDelegate {
|
||||
/**
|
||||
Kick off the startup of the rendering of the main menu.
|
||||
*/
|
||||
public func startup() {
|
||||
func startup() {
|
||||
// Start with the icon
|
||||
self.setStatusBar(image: NSImage(named: NSImage.Name("StatusBarIcon"))!)
|
||||
// Perform environment boot checks
|
||||
@ -75,7 +75,7 @@ class MainMenu: NSObject, NSWindowDelegate {
|
||||
/**
|
||||
Update the menu's contents, based on what's going on.
|
||||
*/
|
||||
public func update() {
|
||||
func update() {
|
||||
// Update the menu item on the main thread
|
||||
DispatchQueue.main.async {
|
||||
// Create a new menu
|
||||
@ -176,13 +176,13 @@ class MainMenu: NSObject, NSWindowDelegate {
|
||||
|
||||
// MARK: - Actions
|
||||
|
||||
@objc public func restartPhpFpm() {
|
||||
@objc func restartPhpFpm() {
|
||||
self.waitAndExecute({
|
||||
Actions.restartPhpFpm()
|
||||
})
|
||||
}
|
||||
|
||||
@objc public func restartAllServices() {
|
||||
@objc func restartAllServices() {
|
||||
self.waitAndExecute({
|
||||
Actions.restartDnsMasq()
|
||||
Actions.restartPhpFpm()
|
||||
@ -190,19 +190,19 @@ class MainMenu: NSObject, NSWindowDelegate {
|
||||
})
|
||||
}
|
||||
|
||||
@objc public func restartNginx() {
|
||||
@objc func restartNginx() {
|
||||
self.waitAndExecute({
|
||||
Actions.restartNginx()
|
||||
})
|
||||
}
|
||||
|
||||
@objc public func restartDnsMasq() {
|
||||
@objc func restartDnsMasq() {
|
||||
self.waitAndExecute({
|
||||
Actions.restartDnsMasq()
|
||||
})
|
||||
}
|
||||
|
||||
@objc public func toggleExtension(sender: ExtensionMenuItem) {
|
||||
@objc func toggleExtension(sender: ExtensionMenuItem) {
|
||||
self.waitAndExecute({
|
||||
// Toggle that extension
|
||||
print("Toggling extension '\(sender.phpExtension!.name)'")
|
||||
@ -210,7 +210,7 @@ class MainMenu: NSObject, NSWindowDelegate {
|
||||
})
|
||||
}
|
||||
|
||||
@objc public func openPhpInfo() {
|
||||
@objc func openPhpInfo() {
|
||||
self.waitAndExecute({
|
||||
try! "<?php phpinfo();".write(toFile: "/tmp/phpmon_phpinfo.php", atomically: true, encoding: .utf8)
|
||||
Shell.run("\(Paths.binPath)/php-cgi -q /tmp/phpmon_phpinfo.php > /tmp/phpmon_phpinfo.html")
|
||||
@ -219,7 +219,7 @@ class MainMenu: NSObject, NSWindowDelegate {
|
||||
})
|
||||
}
|
||||
|
||||
@objc public func forceRestartLatestPhp() {
|
||||
@objc func forceRestartLatestPhp() {
|
||||
// Tell the user the switch is about to occur
|
||||
Alert.notify(message: "alert.force_reload.title".localized, info: "alert.force_reload.info".localized)
|
||||
// Start switching
|
||||
@ -232,7 +232,7 @@ class MainMenu: NSObject, NSWindowDelegate {
|
||||
)
|
||||
}
|
||||
|
||||
@objc public func openActiveConfigFolder() {
|
||||
@objc func openActiveConfigFolder() {
|
||||
if (App.phpInstall!.version.error) {
|
||||
// php version was not identified
|
||||
Actions.openGenericPhpConfigFolder()
|
||||
@ -243,11 +243,11 @@ class MainMenu: NSObject, NSWindowDelegate {
|
||||
Actions.openPhpConfigFolder(version: App.phpInstall!.version.short)
|
||||
}
|
||||
|
||||
@objc public func openValetConfigFolder() {
|
||||
@objc func openValetConfigFolder() {
|
||||
Actions.openValetConfigFolder()
|
||||
}
|
||||
|
||||
@objc public func switchToPhpVersion(sender: PhpMenuItem) {
|
||||
@objc func switchToPhpVersion(sender: PhpMenuItem) {
|
||||
print("Switching to: PHP \(sender.version)")
|
||||
|
||||
self.setBusyImage()
|
||||
@ -282,12 +282,12 @@ class MainMenu: NSObject, NSWindowDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
@objc public func openAbout() {
|
||||
@objc func openAbout() {
|
||||
NSApplication.shared.activate(ignoringOtherApps: true)
|
||||
NSApplication.shared.orderFrontStandardAboutPanel()
|
||||
}
|
||||
|
||||
@objc public func terminateApp() {
|
||||
@objc func terminateApp() {
|
||||
NSApplication.shared.terminate(nil)
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ class Shell {
|
||||
|
||||
- Parameter command: The command to run
|
||||
*/
|
||||
public func run(_ command: String) {
|
||||
func run(_ command: String) {
|
||||
// Equivalent of piping to /dev/null; don't do anything with the string
|
||||
_ = self.pipe(command)
|
||||
}
|
||||
@ -43,7 +43,7 @@ class Shell {
|
||||
- Parameter command: The command to run
|
||||
- Parameter shell: Path to the shell to invoke
|
||||
*/
|
||||
public func pipe(_ command: String, shell: String = "/bin/sh") -> String {
|
||||
func pipe(_ command: String, shell: String = "/bin/sh") -> String {
|
||||
let task = Process()
|
||||
let pipe = Pipe()
|
||||
|
||||
|
Reference in New Issue
Block a user