Files
WP-LIT-MCP/src/Compatibility/ProbeStep.php
T
Jan-Niclas LoosenandClaude Opus 5.5 bee9da3a86 feat(cache): WP Fastest Cache statt WP Super Cache
Die Cache-Integration war für WP Super Cache gebaut, eingesetzt wird aber
WP Fastest Cache. Profil (wpfc), Listener, Drosselung, lit/cache-clear und
Leeren-Probe laufen jetzt über die öffentlichen WPFC-Funktionen
wpfc_clear_post_cache_by_id/wpfc_clear_all_cache; die Probe leert nur die
Wegwerf-Seite (singleDeleteCache ohne Elternseiten) und prüft, dass WPFC
den Hook noch verarbeitet. Smoke fastest-cache-smoke.sh ersetzt den WPSC-Smoke.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 19:57:55 +01:00

41 lines
1.4 KiB
PHP

<?php
declare(strict_types=1);
namespace LIT\MCP\Compatibility;
use Closure;
defined('ABSPATH') || exit;
/** The one check step a profile's behaviour probe makes (Profile::$extraSteps), shared by Pods and WP Fastest Cache. */
final class ProbeStep
{
/**
* Skipped while the manifest is red (the probe would fail anyway). A probe with nothing to probe (null) is a
* green step that says so, not a skipped one: a skipped step makes the report red and would lock the plugin on a
* site that simply has nothing to probe yet.
*
* @param Closure(): (list<string>|null) $probe Problems, [] = green, null = nothing to probe.
* @return Closure(bool): list<CheckStep>
*/
public static function extra(string $key, string $label, string $labelNothingToProbe, Closure $probe): Closure
{
return static function (bool $manifestClean) use ($key, $label, $labelNothingToProbe, $probe): array {
if (! $manifestClean) {
return [new CheckStep($key, [], true, $label)];
}
$none = false;
$problems = CompatibilityCheck::guarded(static function () use ($probe, &$none): array {
$result = $probe();
$none = $result === null;
return $result ?? [];
});
return [new CheckStep($key, $problems, false, $none ? $labelNothingToProbe : $label)];
};
}
}