fix(Batch55): Blocksy guard — BLOCKSY_COMPANION_VERSION is not defined; gate on BLOCKSY_PATH too (verified live on mainwp)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q8t9GEyyLZbUQu26na1JQg
This commit is contained in:
2026-10-16 20:44:44 +00:00
parent 72ac246630
commit 02e2db3b56
+8 -3
View File
@@ -1,7 +1,10 @@
<?php <?php
/** /**
* Batch 55 — Blocksy (Companion) tools. Net-new, GPL-2.0-or-later. See NOTICE.md. * Batch 55 — Blocksy (Companion) tools. Net-new, GPL-2.0-or-later. See NOTICE.md.
* Inert unless Blocksy Companion (BLOCKSY_COMPANION_VERSION) is active. Content blocks are the 'ct_content_block' CPT. * Inert unless Blocksy Companion is active. NOTE: the companion plugin does not define
* BLOCKSY_COMPANION_VERSION; BLOCKSY_PATH / BLOCKSY_PLUGIN_BASE are defined whenever it
* loads, so we gate on either (verified live on mainwp 2026-10-16).
* Content blocks are the 'ct_content_block' CPT.
*/ */
namespace AskTamMCP\Extensions; namespace AskTamMCP\Extensions;
@@ -11,7 +14,7 @@ defined('ABSPATH') || exit;
class Batch55 { class Batch55 {
public static function register($registry): void { public static function register($registry): void {
if (!defined('BLOCKSY_COMPANION_VERSION')) return; if (!defined('BLOCKSY_COMPANION_VERSION') && !defined('BLOCKSY_PATH')) return;
$def = function (string $name, string $desc, array $props, array $required, string $scope, string $method) { $def = function (string $name, string $desc, array $props, array $required, string $scope, string $method) {
$schema = ['type' => 'object', 'properties' => $props ?: new \stdClass()]; $schema = ['type' => 'object', 'properties' => $props ?: new \stdClass()];
@@ -26,7 +29,9 @@ class Batch55 {
} }
public static function detect(array $args): array { public static function detect(array $args): array {
return ['active' => defined('BLOCKSY_COMPANION_VERSION'), 'version' => defined('BLOCKSY_COMPANION_VERSION') ? BLOCKSY_COMPANION_VERSION : null]; $active = defined('BLOCKSY_COMPANION_VERSION') || defined('BLOCKSY_PATH');
$ver = defined('BLOCKSY_COMPANION_VERSION') ? BLOCKSY_COMPANION_VERSION : (defined('BLOCKSY_VERSION') ? BLOCKSY_VERSION : null);
return ['active' => $active, 'version' => $ver];
} }
public static function listContentBlocks(array $args): array { public static function listContentBlocks(array $args): array {