feat(cache): WP Super Cache über den Kompatibilitätskern anbinden

SuperCacheFeature, SuperCacheCompatibility (LockOnFailure, getestet 3.1.5, Version aus dem Plugin-Header) und SuperCacheIntegration ohne Tools. Der SuperCacheListener sammelt Änderungen über lit_mcp_changed und leert einmal am Request-Ende: einen Beitrag per wp_cache_post_edit, mehrere Beiträge oder seitenweite Änderungen per wp_cache_clear_cache (Multisite: eigener Blog). Komplett-Purges höchstens alle 30 s, mit genau einem Nachlauf per WP-Cron. Freigabe-Einträge leeren nichts. Uninstaller räumt Optionen, Transient und Cron-Hook ab; Reiter und lit-site-status zeigen das Profil automatisch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jan-Niclas Loosen
2026-11-06 14:50:35 +01:00
co-authored by Claude Opus 5.5
parent c383b99e7d
commit 05bf890481
16 changed files with 1054 additions and 21 deletions
+20 -5
View File
@@ -48,7 +48,7 @@ final class PluginTest extends TestCase
public function testIntegrationsInRegistryOrder(): void
{
self::assertSame(
['core', 'wordpress', 'media', 'divi', 'divi-library', 'divi-theme-builder', 'pods'],
['core', 'wordpress', 'media', 'divi', 'divi-library', 'divi-theme-builder', 'pods', 'wpsc'],
self::registry()->ids()
);
}
@@ -95,8 +95,17 @@ final class PluginTest extends TestCase
self::assertArrayNotHasKey('pods', $registry->grouped());
}
/** lit-site-status keeps its order: Divi, Pods, The Events Calendar. */
public function testSiteStatusListsDiviPodsAndTheEventsCalendarInThatOrder(): void
/** WP Super Cache has no tools either: registered for its profile only. */
public function testSuperCacheIsRegisteredWithoutBecomingAToolGroup(): void
{
$registry = self::registry();
self::assertContains('wpsc', $registry->ids());
self::assertArrayNotHasKey('wpsc', $registry->grouped());
}
/** lit-site-status keeps its order: Divi, Pods, WP Super Cache, The Events Calendar. */
public function testSiteStatusListsDiviPodsSuperCacheAndTheEventsCalendarInThatOrder(): void
{
Functions\when('get_bloginfo')->justReturn('x');
Functions\when('home_url')->justReturn('https://example.test');
@@ -113,17 +122,23 @@ final class PluginTest extends TestCase
$components = $status->execute([])['components'];
self::assertSame(['divi', 'pods', 'the-events-calendar'], array_column($components, 'id'));
self::assertSame(['divi', 'pods', 'wpsc', 'the-events-calendar'], array_column($components, 'id'));
$pods = array_column($components, null, 'id')['pods'];
self::assertFalse($pods['active'], 'no Pods in unit tests');
self::assertSame([], $pods['problems']);
$wpsc = array_column($components, null, 'id')['wpsc'];
self::assertFalse($wpsc['active'], 'no WP Super Cache in unit tests');
self::assertSame([], $wpsc['problems']);
}
public function testTheCompatibilityCoversAllProfilesWithoutIdCollision(): void
{
$compat = self::registry()->compatibility();
self::assertSame(['divi', 'pods'], array_map(static fn (Profile $p): string => $p->id, $compat->profiles()));
$ids = array_map(static fn (Profile $p): string => $p->id, $compat->profiles());
self::assertSame(['divi', 'pods', 'wpsc'], $ids);
self::assertSame($ids, array_values(array_unique($ids)));
self::assertSame('wpsc', $compat->owner($compat->capability('wpsc-purge-all'))?->id);
self::assertNotNull($compat->capability('page-write'));
self::assertNotNull($compat->capability('pods-field-read'));
self::assertSame('divi', $compat->owner($compat->capability('page-write'))?->id);