feat: DiviCompatibility checks the TB cache function, divi/global-layout and the library term taxonomies (M-6)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-27 04:23:06 +02:00
co-authored by Claude Opus 5.5
parent a413f761e7
commit be5dde2b64
2 changed files with 41 additions and 2 deletions
+38 -2
View File
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace LIT\MCP\Integrations\Divi; namespace LIT\MCP\Integrations\Divi;
use LIT\MCP\Integrations\Divi\BlockTree\GlobalInstance;
use LIT\MCP\Integrations\Divi\Library\DiviLibraryStore; use LIT\MCP\Integrations\Divi\Library\DiviLibraryStore;
use LIT\MCP\Integrations\Divi\Pages\DynamicContentMap; use LIT\MCP\Integrations\Divi\Pages\DynamicContentMap;
use LIT\MCP\Integrations\Divi\Schema\DiviModules; use LIT\MCP\Integrations\Divi\Schema\DiviModules;
@@ -13,8 +14,9 @@ defined('ABSPATH') || exit;
/** /**
* Live check of the Divi internals LIT MCP relies on (decisions note §5, E15): classes, * Live check of the Divi internals LIT MCP relies on (decisions note §5, E15): classes,
* functions, the library post type and taxonomies. lit-site-status shows the failed checks, so a * functions, the library post type and taxonomies, the instance block type. lit-site-status shows
* Divi update that moves one of them is visible before a tool reports "unsupported". * the failed checks, so a Divi update that moves one of them is visible before a tool reports
* "unsupported".
*/ */
final class DiviCompatibility final class DiviCompatibility
{ {
@@ -56,6 +58,40 @@ final class DiviCompatibility
'GlobalLayout::is_global_layout_template (globale Module)' => 'GlobalLayout::is_global_layout_template (globale Module)' =>
static fn (): bool => method_exists(DiviLibraryStore::GLOBAL_LAYOUT, 'is_global_layout_template'), 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_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'),
]; ];
} }
/**
* Whether Divi still has the block type of global instances (GlobalInstance::BLOCK): registered
* with WordPress, or in Divi's core module metadata (Divi renders instances itself, BlockParser,
* and does not always register the type with WordPress).
*/
private static function knowsGlobalLayout(): bool
{
if (
class_exists('WP_Block_Type_Registry')
&& \WP_Block_Type_Registry::get_instance()->is_registered(GlobalInstance::BLOCK)
) {
return true;
}
$registration = 'ET\Builder\Packages\ModuleLibrary\ModuleRegistration';
if (! method_exists($registration, 'get_all_core_modules_metadata')) {
return false;
}
foreach ((array) $registration::get_all_core_modules_metadata() as $module) {
if (is_array($module) && ($module['name'] ?? null) === GlobalInstance::BLOCK) {
return true;
}
}
return false;
}
} }
@@ -34,6 +34,9 @@ final class DiviCompatibilityTest extends TestCase
'Taxonomien scope, layout_type, module_width (Bibliothek)', 'Taxonomien scope, layout_type, module_width (Bibliothek)',
'GlobalLayout::is_global_layout_template (globale Module)', 'GlobalLayout::is_global_layout_template (globale Module)',
'ET_Core_PageResource (CSS-Cache)', 'ET_Core_PageResource (CSS-Cache)',
'et_theme_builder_clear_wp_cache (Theme-Builder-Cache)',
'Block-Typ divi/global-layout (Instanzen globaler Module)',
'Taxonomien layout_category, layout_tag (Bibliothek)',
], ],
array_keys(DiviCompatibility::defaults()) array_keys(DiviCompatibility::defaults())
); );