refactor: one site-wide Divi cache clear and one compatibility row (review M-1, M-2)

DiviSaver's site-wide scopes and the Theme Builder tools now share
DiviThemeBuilder::clearSiteCaches(), which clears the Theme Builder cache
even when ET_Core_PageResource is missing. lit-site-status no longer lists
et_theme_builder_clear_wp_cache twice: the Theme Builder functions row
covers it, and the post-type row uses DiviThemeBuilder::postTypes().

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-27 23:07:57 +02:00
co-authored by Claude Opus 5.5
parent e64d32b1f1
commit 5290a9d81d
5 changed files with 36 additions and 17 deletions
+2 -6
View File
@@ -59,19 +59,15 @@ final class DiviCompatibility
'GlobalLayout::is_global_layout_template (globale Module)' =>
static fn (): bool => method_exists(DiviLibraryStore::GLOBAL_LAYOUT, 'is_global_layout_template'),
'ET_Core_PageResource (CSS-Cache)' => static fn (): bool => class_exists('ET_Core_PageResource'),
'et_theme_builder_clear_wp_cache (Theme-Builder-Cache)' =>
static fn (): bool => function_exists('et_theme_builder_clear_wp_cache'),
'Block-Typ divi/global-layout (Instanzen globaler Module)' =>
static fn (): bool => self::knowsGlobalLayout(),
'Taxonomien layout_category, layout_tag (Bibliothek)' =>
static fn (): bool => taxonomy_exists('layout_category') && taxonomy_exists('layout_tag'),
// Includes et_theme_builder_clear_wp_cache (Theme Builder cache of every site-wide clear, review M-2).
'Theme Builder: Funktionen et_theme_builder_* und et_()' =>
static fn (): bool => (new DiviThemeBuilder())->missing() === [],
'Theme Builder: Post-Typen et_template und Layouts' => static fn (): bool => array_filter(
array_merge(
[DiviThemeBuilder::THEME_BUILDER, DiviThemeBuilder::TEMPLATE],
array_values(DiviThemeBuilder::LAYOUT_TYPES)
),
DiviThemeBuilder::postTypes(),
static fn (string $type): bool => ! post_type_exists($type)
) === [],
];
+4 -7
View File
@@ -8,6 +8,7 @@ use LIT\MCP\Abilities\Errors;
use LIT\MCP\Abilities\FollowUp;
use LIT\MCP\Abilities\Rollback;
use LIT\MCP\Abilities\WriteFailed;
use LIT\MCP\Integrations\Divi\ThemeBuilder\DiviThemeBuilder;
use LIT\MCP\Integrations\WordPress\PostGuard;
use LIT\MCP\Integrations\WordPress\RevisionPoint;
use RuntimeException;
@@ -106,16 +107,12 @@ class DiviSaver
}
FollowUp::run(
static function () use ($postId, $scope): void {
if (! class_exists('ET_Core_PageResource')) {
return;
if (class_exists('ET_Core_PageResource')) {
\ET_Core_PageResource::remove_static_resources($postId, 'all', true);
}
\ET_Core_PageResource::remove_static_resources($postId, 'all', true);
// A global library entry is part of every page that shows it (spec §5.6 step 5).
if ($scope->clearsSiteCss()) {
\ET_Core_PageResource::remove_static_resources('all', 'all', true);
if (function_exists('et_theme_builder_clear_wp_cache')) {
et_theme_builder_clear_wp_cache('all');
}
DiviThemeBuilder::clearSiteCaches();
}
},
'divi static css',
@@ -341,12 +341,21 @@ class DiviThemeBuilder
/** Divi's Theme Builder cache and every static CSS file (spec §5.6 step 5; api.php:249-254). */
public function clearCaches(): void
{
if (function_exists('et_theme_builder_clear_wp_cache')) {
et_theme_builder_clear_wp_cache('all');
}
self::clearSiteCaches();
}
/**
* The site-wide clear shared by the Theme Builder tools and DiviSaver's site-wide scopes (review M-1): every
* static CSS file and Divi's Theme Builder cache, each when Divi provides it.
*/
public static function clearSiteCaches(): void
{
if (class_exists('ET_Core_PageResource')) {
\ET_Core_PageResource::remove_static_resources('all', 'all', true);
}
if (function_exists('et_theme_builder_clear_wp_cache')) {
et_theme_builder_clear_wp_cache('all');
}
}
/**