Skip to content

Commit e042f59

Browse files
🚀 Version 25.11.1
2 parents dac6899 + 0f2f281 commit e042f59

File tree

25 files changed

+94
-152
lines changed

25 files changed

+94
-152
lines changed

PHP Monitor.xcodeproj/project.pbxproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3960,7 +3960,7 @@
39603960
CODE_SIGN_IDENTITY = "Apple Development";
39613961
CODE_SIGN_STYLE = Automatic;
39623962
COMBINE_HIDPI_IMAGES = YES;
3963-
CURRENT_PROJECT_VERSION = 1715;
3963+
CURRENT_PROJECT_VERSION = 1735;
39643964
DEAD_CODE_STRIPPING = YES;
39653965
DEBUG = YES;
39663966
ENABLE_APP_SANDBOX = NO;
@@ -3979,7 +3979,7 @@
39793979
"@executable_path/../Frameworks",
39803980
);
39813981
MACOSX_DEPLOYMENT_TARGET = 13.5;
3982-
MARKETING_VERSION = 25.11;
3982+
MARKETING_VERSION = 25.11.1;
39833983
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
39843984
PRODUCT_MODULE_NAME = PHP_Monitor;
39853985
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -4004,7 +4004,7 @@
40044004
CODE_SIGN_IDENTITY = "Apple Development";
40054005
CODE_SIGN_STYLE = Automatic;
40064006
COMBINE_HIDPI_IMAGES = YES;
4007-
CURRENT_PROJECT_VERSION = 1715;
4007+
CURRENT_PROJECT_VERSION = 1735;
40084008
DEAD_CODE_STRIPPING = YES;
40094009
DEBUG = NO;
40104010
ENABLE_APP_SANDBOX = NO;
@@ -4023,7 +4023,7 @@
40234023
"@executable_path/../Frameworks",
40244024
);
40254025
MACOSX_DEPLOYMENT_TARGET = 13.5;
4026-
MARKETING_VERSION = 25.11;
4026+
MARKETING_VERSION = 25.11.1;
40274027
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
40284028
PRODUCT_MODULE_NAME = PHP_Monitor;
40294029
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -4186,7 +4186,7 @@
41864186
CODE_SIGN_IDENTITY = "Apple Development";
41874187
CODE_SIGN_STYLE = Automatic;
41884188
COMBINE_HIDPI_IMAGES = YES;
4189-
CURRENT_PROJECT_VERSION = 1715;
4189+
CURRENT_PROJECT_VERSION = 1735;
41904190
DEAD_CODE_STRIPPING = YES;
41914191
DEBUG = YES;
41924192
ENABLE_APP_SANDBOX = NO;
@@ -4205,7 +4205,7 @@
42054205
"@executable_path/../Frameworks",
42064206
);
42074207
MACOSX_DEPLOYMENT_TARGET = 13.5;
4208-
MARKETING_VERSION = 25.11;
4208+
MARKETING_VERSION = 25.11.1;
42094209
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon.eap;
42104210
PRODUCT_MODULE_NAME = PHP_Monitor;
42114211
PRODUCT_NAME = "$(TARGET_NAME) EAP";
@@ -4379,7 +4379,7 @@
43794379
CODE_SIGN_IDENTITY = "Apple Development";
43804380
CODE_SIGN_STYLE = Automatic;
43814381
COMBINE_HIDPI_IMAGES = YES;
4382-
CURRENT_PROJECT_VERSION = 1715;
4382+
CURRENT_PROJECT_VERSION = 1735;
43834383
DEAD_CODE_STRIPPING = YES;
43844384
DEBUG = NO;
43854385
ENABLE_APP_SANDBOX = NO;
@@ -4398,7 +4398,7 @@
43984398
"@executable_path/../Frameworks",
43994399
);
44004400
MACOSX_DEPLOYMENT_TARGET = 13.5;
4401-
MARKETING_VERSION = 25.11;
4401+
MARKETING_VERSION = 25.11.1;
44024402
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon.eap;
44034403
PRODUCT_MODULE_NAME = PHP_Monitor;
44044404
PRODUCT_NAME = "$(TARGET_NAME) EAP";

phpmon/Common/Extensions/StringExtension.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,4 +164,10 @@ extension String {
164164
of: "^[0-9]*$", // 1
165165
options: .regularExpression) != nil
166166
}
167+
168+
// MARK: - Helpers
169+
170+
var withDisplayName: String {
171+
return self.replacing("PHP Monitor", with: App.displayName)
172+
}
167173
}

phpmon/Common/Filesystem/RealFileSystem.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ import Foundation
1010

1111
extension String {
1212
var replacingTildeWithHomeDirectory: String {
13+
// Skip replacement if not necessary
14+
if !self.contains("~") {
15+
return self
16+
}
17+
1318
// Try and check if there's a shared container
1419
if let paths = App.shared.container.paths {
1520
return self.replacing("~", with: paths.homePath)

phpmon/Common/PHP/PHP Version/PhpEnvironments.swift

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,16 @@ class PhpEnvironments {
2626
If invalid, this will prevent PHP Monitor from starting correctly.
2727
*/
2828
func getHomebrewInformation() async {
29-
let brewPhpAlias = await container.shell.pipe("\(container.paths.brew) info php --json").out
29+
// Let's see which formula we need to check
30+
var formulaToLoad = "php"
31+
32+
// Depending on whether the `shivammathur/php` tap is installed, this command will vary
33+
if BrewDiagnostics.shared.installedTaps.contains("shivammathur/php") {
34+
formulaToLoad = "shivammathur/php/php"
35+
}
36+
37+
// Let's check the alias by using `brew info`
38+
let brewPhpAlias = await container.shell.pipe("\(container.paths.brew) info \(formulaToLoad) --json").out
3039

3140
// Remove any non-JSON output (progress indicators, etc.) before the actual JSON array
3241
// This is a workaround for https://github.com/homebrew/brew/issues/20978
@@ -75,7 +84,7 @@ class PhpEnvironments {
7584
if let version = try? VersionNumber.parse(longVersionString) {
7685
PhpEnvironments.brewPhpAlias = version.short
7786
if version.short != homebrewPackage.version {
78-
Log.info("[BREW] An older version of `php` is actually installed (\(version.short)).")
87+
Log.info("[BREW] An older or newer version of `php` is actually installed (\(version.short)).")
7988
}
8089
} else {
8190
Log.warn("Could not determine the actual version of the php binary; assuming Homebrew is correct.")

phpmon/Domain/App/App.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ class App {
1717
/** Use to determine whether a loaded testable configuration is being used. */
1818
static var hasLoadedTestableConfiguration: Bool = false
1919

20+
/** The display name of the app, as declared in Info.plist. */
21+
static var displayName: String {
22+
return Bundle.main.infoDictionary?["CFBundleName"] as! String
23+
}
24+
2025
/** Retrieve the version number from the main info dictionary, Info.plist. */
2126
static var version: String {
2227
let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as! String

phpmon/Domain/App/Startup.swift

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,17 +147,33 @@ class Startup {
147147
descriptionText: "startup.errors.dyld_library.desc".localized
148148
),
149149
// =================================================================================
150-
// Make sure we can get valid output from Homebrew's info command.
150+
// Make sure we can get valid output from Homebrew's `info` command.
151151
// =================================================================================
152152
EnvironmentCheck(
153153
command: { container in
154+
// first, verify the taps
155+
await BrewDiagnostics.shared.loadInstalledTaps()
156+
// then, check the Homebrew information
154157
await container.phpEnvs.getHomebrewInformation()
155158
return container.phpEnvs.homebrewPackage == nil
156159
},
157160
name: "`brew info php --json` could parse valid JSON",
158161
titleText: "startup.errors.php_brew_info_invalid.title".localized,
159162
subtitleText: "startup.errors.php_brew_info_invalid.subtitle".localized,
160163
descriptionText: "startup.errors.php_brew_info_invalid.desc".localized
164+
),
165+
// =================================================================================
166+
// Make sure we can determine the PHP alias.
167+
// =================================================================================
168+
EnvironmentCheck(
169+
command: { container in
170+
await container.phpEnvs.determinePhpAlias()
171+
return PhpEnvironments.brewPhpAlias == nil
172+
},
173+
name: "`brew` alias is not nil and valid",
174+
titleText: "startup.errors.could_not_determine_alias.title".localized,
175+
subtitleText: "startup.errors.could_not_determine_alias.subtitle".localized,
176+
descriptionText: "startup.errors.could_not_determine_alias.desc".localized
161177
)
162178
]),
163179
EnvironmentCheckGroup(name: "valet", condition: { return Valet.installed }, checks: [

phpmon/Domain/Integrations/Homebrew/BrewDiagnostics.swift

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -120,19 +120,6 @@ class BrewDiagnostics {
120120
}
121121
}
122122

123-
/**
124-
It is possible to have the `shivammathur/php` tap installed, and for the core homebrew information to be outdated.
125-
This will then result in two different aliases claiming to point to the same formula (`php`).
126-
This will break all linking functionality in PHP Monitor, and the user needs to be informed of this.
127-
128-
This check only needs to be performed if the `shivammathur/php` tap is active.
129-
*/
130-
public func checkForCaskConflict() async {
131-
if await hasAliasConflict() {
132-
presentAlertAboutConflict()
133-
}
134-
}
135-
136123
/**
137124
It is possible to upgrade PHP, but forget running `valet install`.
138125
This results in a scenario where a rogue www.conf file exists.
@@ -175,69 +162,6 @@ class BrewDiagnostics {
175162
}
176163
}
177164

178-
/**
179-
Check if the alias conflict as documented in `checkForCaskConflict` actually occurred.
180-
*/
181-
private func hasAliasConflict() async -> Bool {
182-
let tapAlias = await container.shell.pipe("brew info shivammathur/php/php --json").out
183-
184-
if tapAlias.contains("brew tap shivammathur/php") || tapAlias.contains("Error") || tapAlias.isEmpty {
185-
Log.info("The user does not appear to have tapped: shivammathur/php")
186-
return false
187-
} else {
188-
Log.info("The user DOES have the following tapped: shivammathur/php")
189-
Log.info("Checking for `php` formula conflicts...")
190-
191-
let tapPhp = try! JSONDecoder().decode(
192-
[HomebrewPackage].self,
193-
from: tapAlias.data(using: .utf8)!
194-
).first!
195-
196-
guard let tapPhpVersion = tapPhp.version else {
197-
Log.warn("The `php` formula could not be determined.")
198-
return false
199-
}
200-
201-
if PhpEnvironments.brewPhpAlias != nil && tapPhp.version != PhpEnvironments.brewPhpAlias {
202-
Log.warn("The `php` formula alias seems to be the different between the tap and core. "
203-
+ "This could be a problem!")
204-
Log.info("Determining whether both of these versions are installed...")
205-
206-
let availablePhpVersions = container.phpEnvs.availablePhpVersions
207-
208-
let bothInstalled = availablePhpVersions.contains(tapPhpVersion)
209-
&& availablePhpVersions.contains(PhpEnvironments.brewPhpAlias!)
210-
211-
if bothInstalled {
212-
Log.warn("Both conflicting aliases seem to be installed, warning the user!")
213-
} else {
214-
Log.info("Conflicting aliases are not both installed, seems fine!")
215-
}
216-
217-
return bothInstalled
218-
}
219-
220-
Log.info("All seems to be OK. No conflicts, both are PHP \(tapPhpVersion).")
221-
222-
return false
223-
}
224-
}
225-
226-
/**
227-
Show this alert in case the tapped Cask does cause issues because of the conflict.
228-
*/
229-
private func presentAlertAboutConflict() {
230-
Task { @MainActor in
231-
NVAlert()
232-
.withInformation(
233-
title: "alert.php_alias_conflict.title".localized,
234-
subtitle: "alert.php_alias_conflict.info".localized
235-
)
236-
.withPrimary(text: "generic.ok".localized)
237-
.show()
238-
}
239-
}
240-
241165
/**
242166
In order to see if we support the --json syntax, we'll query nginx.
243167
If the JSON response cannot be parsed, Homebrew is probably out of date.

phpmon/Domain/Menu/MainMenu+Startup.swift

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ extension MainMenu {
3333
// Load additional preferences
3434
await container.preferences.loadCustomPreferences()
3535

36-
// Determine what the `php` formula is aliased to
36+
// Determine what the `php` formula is aliased to (again)
3737
await container.phpEnvs.determinePhpAlias()
3838

3939
// Make sure that broken symlinks are removed ASAP
@@ -53,15 +53,11 @@ extension MainMenu {
5353
// Validate the Homebrew version (determines install/upgrade functionality)
5454
await Brew.shared.determineVersion()
5555

56-
// Actually detect the PHP versions
57-
await container.phpEnvs.reloadPhpVersions()
58-
59-
// Verify third party taps
60-
// The missing tap(s) will be actionable later
56+
// Verify third party taps (will display as warning)
6157
await BrewDiagnostics.shared.verifyThirdPartyTaps()
6258

63-
// Check for an alias conflict
64-
await BrewDiagnostics.shared.checkForCaskConflict()
59+
// Actually detect the PHP versions
60+
await container.phpEnvs.reloadPhpVersions()
6561

6662
// Set up the filesystem watcher for the Homebrew binaries
6763
App.shared.prepareHomebrewWatchers()

phpmon/Domain/Menu/StatusMenu+Items.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ extension StatusMenu {
127127
@MainActor func addCoreMenuItems() {
128128
addItems([
129129
NSMenuItem.separator(),
130-
NSMenuItem(title: "mi_about".localized,
130+
NSMenuItem(title: "mi_about".localized.withDisplayName,
131131
action: #selector(MainMenu.openAbout)),
132-
NSMenuItem(title: "mi_quit".localized,
132+
NSMenuItem(title: "mi_quit".localized.withDisplayName,
133133
action: #selector(MainMenu.terminateApp), keyEquivalent: "q")
134134
])
135135
}

phpmon/Modules/Domain List/UI/DomainListVC+Window.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ extension DomainListVC {
2121
guard let window = windowController.window else { return }
2222

2323
window.title = "domain_list.title".localized
24-
window.subtitle = "domain_list.subtitle".localized
24+
window.subtitle = ""
2525
window.delegate = delegate ?? windowController
2626
window.styleMask = [.titled, .closable, .resizable, .miniaturizable]
2727
window.minSize = NSSize(width: 550, height: 200)

0 commit comments

Comments
 (0)