fix: discovery admin notice fires on cached 'recommended' too, guarded against oauth/permalink early returns

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
This commit is contained in:
2026-09-26 03:30:11 +02:00
co-authored by Claude Opus 5.5
parent f084c47311
commit 169d5772b5
4 changed files with 126 additions and 15 deletions
+17 -1
View File
@@ -30,8 +30,24 @@ final class AdminNotices
) . ' ' . __('Claude kann sich nicht verbinden.', 'wp-lit-mcp');
}
/*
* Fire whenever the cached discovery result is not 'good' (this also covers
* 'recommended', which is how HealthCheck::run_self_check() itself reports both
* a genuine reachability problem and its acme-challenge-fingerprint "critical"
* case) — but only when oauth is enabled and permalinks are pretty. Those two
* conditions are exactly when run_self_check() short-circuits to its own
* disabled/permalink-missing early returns instead of a real check; guarding on
* them here (rather than trying to recognise their shape from the cached array)
* keeps this correct even though, in the vendor's current implementation,
* neither early return is ever persisted to the transient we read.
*/
$discovery = $this->status->discovery(false);
if (is_array($discovery) && ($discovery['status'] ?? 'good') === 'critical') {
if (
$this->status->oauthEnabled()
&& $this->status->permalinksPretty()
&& is_array($discovery)
&& ($discovery['status'] ?? 'good') !== 'good'
) {
$messages[] = __(
'LIT MCP: Die OAuth-Discovery-Dokumente unter /.well-known/ sind nicht erreichbar.',
'wp-lit-mcp'