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>
This commit is contained in:
Jan-Niclas Loosen
2026-11-06 19:57:55 +01:00
co-authored by Claude Opus 5.5
parent e1fad3dffe
commit bee9da3a86
33 changed files with 1231 additions and 1441 deletions
@@ -0,0 +1,75 @@
<?php
declare(strict_types=1);
namespace LIT\MCP\Integrations\FastestCache;
use LIT\MCP\Admin\CompatibilityTab;
use LIT\MCP\ChangeLog\ChangeLog;
use LIT\MCP\Compatibility\ProvidesCompatibility;
use LIT\MCP\Integrations\Bootable;
use LIT\MCP\Integrations\Integration;
defined('ABSPATH') || exit;
/**
* WP Fastest Cache: the compatibility profile (FastestCacheListener purges after writes, wired by Plugin), the
* cleanup of probe pages a dead check left behind and the tool lit/cache-clear – a tool group only while WP Fastest
* Cache is loaded.
*/
final class FastestCacheIntegration implements Integration, ProvidesCompatibility, Bootable
{
/** @var callable(): bool */
private $available;
/** @param callable(): bool|null $available Whether WP Fastest Cache is loaded; null = WPFC_MAIN_PATH is defined. */
public function __construct(
?callable $available,
private FastestCachePurger $purger,
private ChangeLog $log
) {
$this->available = $available ?? static fn (): bool => defined('WPFC_MAIN_PATH');
}
public function boot(): void
{
add_action(CompatibilityTab::LOAD_ACTION, [$this, 'removeOrphans']);
}
/**
* lit_mcp_compat_profile_load('wpfc'), before any output: deletes probe pages a dead check left behind
* (FastestCacheProbe::removeOrphans()). A GET without nonce on purpose: only the plugin's own leftovers,
* idempotent.
*/
public function removeOrphans(string $profileId): void
{
if ($profileId === 'wpfc' && $this->isAvailable() && current_user_can('manage_options')) {
FastestCacheProbe::removeOrphans();
}
}
public function id(): string
{
return 'wpfc';
}
public function label(): string
{
return FastestCacheCompatibility::LABEL;
}
public function isAvailable(): bool
{
return ($this->available)();
}
public function abilities(): array
{
return [new CacheClearAbility($this->purger, $this->log)];
}
public function compatibilities(): array
{
return [FastestCacheCompatibility::profile()];
}
}