fix(Batch37): MailPoet guard — MAILPOET_VERSION is not defined at load; gate on MAILPOET_MINIMUM_REQUIRED_WP_VERSION 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:
@@ -1,7 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* Batch 37 — MailPoet tools (reads the plugin's own tables via $wpdb).
|
||||
* Net-new, GPL-2.0-or-later. See NOTICE.md. Inert unless MailPoet (MAILPOET_VERSION) is active.
|
||||
* Net-new, GPL-2.0-or-later. See NOTICE.md.
|
||||
* Inert unless MailPoet is active. NOTE: MailPoet does not define MAILPOET_VERSION
|
||||
* as a plain constant at load; MAILPOET_MINIMUM_REQUIRED_WP_VERSION is defined whenever
|
||||
* mailpoet.php loads, so we gate on either (verified live on mainwp 2026-10-16).
|
||||
*/
|
||||
|
||||
namespace AskTamMCP\Extensions;
|
||||
@@ -11,7 +14,7 @@ defined('ABSPATH') || exit;
|
||||
class Batch37 {
|
||||
|
||||
public static function register($registry): void {
|
||||
if (!defined('MAILPOET_VERSION')) return;
|
||||
if (!defined('MAILPOET_VERSION') && !defined('MAILPOET_MINIMUM_REQUIRED_WP_VERSION')) return;
|
||||
|
||||
$def = function (string $name, string $desc, array $props, array $required, string $scope, string $method) {
|
||||
$schema = ['type' => 'object', 'properties' => $props ?: new \stdClass()];
|
||||
@@ -29,7 +32,8 @@ class Batch37 {
|
||||
}
|
||||
|
||||
public static function detect(array $args): array {
|
||||
return ['active' => defined('MAILPOET_VERSION'), 'version' => defined('MAILPOET_VERSION') ? MAILPOET_VERSION : null];
|
||||
$active = defined('MAILPOET_VERSION') || defined('MAILPOET_MINIMUM_REQUIRED_WP_VERSION');
|
||||
return ['active' => $active, 'version' => defined('MAILPOET_VERSION') ? MAILPOET_VERSION : null];
|
||||
}
|
||||
|
||||
private static function tbl(string $n): string { global $wpdb; return $wpdb->prefix . $n; }
|
||||
|
||||
Reference in New Issue
Block a user