Files
2meet-data-optimizer-hivepr…/includes/hivepress/adapters/class-tmdo-hivepress-memberships-adapter.php
T
wpdev 0254e40d83
Tests / PHP Lint (pull_request) Successful in 50s
Tests / Unit Tests (pull_request) Successful in 58s
Tests / Integration Tests (pull_request) Successful in 57s
refactor(2meet-data-optimizer-hivepress-addon): stop registering Hot zone fields
- ADR-003 step 4 (AddOn side): core, requests, bookings, memberships and
  marketplace adapters no longer register zone=hot fields or contribute
  hot_* FSM modules; their keys live in TMDO_HivePress_Entity_Groups.
  Cold/warm registrations are unchanged.
- Hot-table doctor probes go with them (trait defaults apply). The
  hot-clause query rewrite and cron optimizer are now inert and are left
  for the ADR step-5 removal together with core's hot path.
- New NoHotZoneRegistrationTest pins the invariant across all 13 adapters;
  per-adapter hot assertions removed.
- Verify: HP unit 142 / integration 49 green, phpcs clean (WordPress)
- PR: PR-037
2026-09-26 01:13:35 +08:00

78 lines
2.0 KiB
PHP

<?php
/**
* Memberships adapter — `hivepress-memberships`.
*
* Two post-type models:
*
* - Membership_Plan (post_type=hp_membership_plan)
* hp_expire_period (int), hp_primary (bool)
*
* - Membership (post_type=hp_membership)
* hp_expired_time (unix ts) — checked on every page load
*
* Flattened by the `hp_membership_plan_core` / `hp_membership_core` entity
* groups (TMDO_HivePress_Entity_Groups); the adapter registers no zone fields.
*
* @package WP_Data_Optimizer
* @since 3.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'TMDO_HivePress_Memberships_Adapter' ) ) {
/**
* Memberships addon adapter.
*/
final class TMDO_HivePress_Memberships_Adapter implements TMDO_HivePress_Adapter {
use TMDO_HivePress_Adapter_Trait;
/**
* Constructor — bind register hooks via inherited trait.
*/
public function __construct() {
$this->bind_anti_eav_hooks();
}
/** Adapter slug (matches wp.org plugin slug). */
public function plugin_slug(): string {
return 'hivepress-memberships';
}
/** Class probed for addon presence. */
public function detection_class(): string {
return 'HivePress\\Memberships\\Plugin';
}
/** Version constant probed for addon presence. */
public function detection_const(): string {
return 'HIVEPRESS_MEMBERSHIPS_VERSION';
}
/** Minimum addon version supported. */
public function minimum_addon_version(): string {
return '2.0.0';
}
/**
* 8-D self-score.
*
* D1: 1.0 — adapter never calls *_meta()
* D2: 1.0 — uses wpdb prefix
* D3: 1.0 — both models have hot tables
* D4: 1.0 — every field has explicit data_type + indexed flag
* D5: 1.0 — single-adapter scope
* D6: 1.0 — zero options/transients
* D7: 1.0 — only registers fields, no cross-table queries
* D8: 1.0 — hot column on hp_expired_time = indexed range scan
*/
public function suitability_score(): array {
return $this->compose_score( array() );
}
}
} // end if ( ! class_exists )