refactor(2meet-data-optimizer-hivepress-addon): remove comment mirror writes to never-created tables

- Favorites/Messages adapters reduced to detection only; Requests keeps hot_hp_request fields, drops hp_offer mirror
- Delete TMDO_HivePress_Comment_Router (read path to wpdo_comment_hp_* tables that no installer creates)
- Verify: addon unit 141 OK, integration 52 OK; phpcs 41E/57W → 35E/48W
- PR: PR-013
This commit is contained in:
2026-09-25 22:58:34 +08:00
parent f089b0934b
commit 5777210184
17 changed files with 77 additions and 1108 deletions
@@ -8,27 +8,9 @@
* - listing → comment_post_ID
* - added_at → comment_date
*
* Problem: `wp_comments` has no UNIQUE constraint on (user_id, comment_post_ID, comment_type).
* A double-tap on the favourite button can race and create two duplicate
* favourite rows. HivePress relies on application-level dedup (SELECT before
* INSERT) which is not race-safe.
*
* Fix: shadow table `wp_wpdo_comment_hp_favorite` with UNIQUE(user_id, listing_id).
* Adapter mirrors every favorite write into the shadow table; the comment
* router rewrites "is X favorited by user Y" reads to hit the shadow table
* (1 indexed lookup vs WP_Comment_Query meta scan).
*
* Schema (declared via expected_columns; created by TMDO_Schema_Manager
* when adapter mode flips to dual_write):
*
* CREATE TABLE wp_wpdo_comment_hp_favorite (
* comment_id BIGINT UNSIGNED NOT NULL PRIMARY KEY,
* user_id BIGINT UNSIGNED NOT NULL,
* listing_id BIGINT UNSIGNED NOT NULL,
* created_at DATETIME NOT NULL,
* UNIQUE KEY unique_user_listing (user_id, listing_id),
* KEY idx_listing (listing_id)
* );
* Nothing is stored in comment meta, so there is no EAV surface to flatten:
* the adapter only reports detection and doctor status. (It used to mirror
* favorites into `wpdo_comment_hp_favorite`, a table nothing ever created.)
*
* @package WP_Data_Optimizer
* @since 3.0.0
@@ -41,18 +23,15 @@ if ( ! defined( 'ABSPATH' ) ) {
if ( ! class_exists( 'TMDO_HivePress_Favorites_Adapter' ) ) {
/**
* Favorites addon adapter.
* Favorites addon adapter (detection and doctor only).
*/
final class TMDO_HivePress_Favorites_Adapter implements TMDO_HivePress_Adapter {
use TMDO_HivePress_Adapter_Trait;
/** Comment_type owned by this adapter. */
/** Comment_type of the Favorite model. */
public const COMMENT_TYPE = 'hp_favorite';
/** Shadow table name (without wpdb prefix). */
public const TABLE = 'wpdo_comment_hp_favorite';
/**
* Constructor — bind register hooks via inherited trait.
*/
@@ -79,156 +58,6 @@ if ( ! class_exists( 'TMDO_HivePress_Favorites_Adapter' ) ) {
public function minimum_addon_version(): string {
return '1.2.0';
}
/**
* Declare the shadow table to the Custom_Table_Registry.
*
* @param TMDO_Custom_Table_Registry $registry Registry singleton.
*/
public function on_register_custom_tables( TMDO_Custom_Table_Registry $registry ): void {
$this->register_custom_table(
$registry,
array(
'table_name' => self::TABLE,
'primary_key' => 'comment_id',
'post_type_link' => null,
'expected_columns' => array(
'comment_id' => 'BIGINT UNSIGNED NOT NULL PRIMARY KEY',
'user_id' => 'BIGINT UNSIGNED NOT NULL',
'listing_id' => 'BIGINT UNSIGNED NOT NULL',
'created_at' => 'DATETIME NOT NULL',
),
'indexes' => array(
'unique_user_listing' => 'UNIQUE (user_id, listing_id)',
'idx_listing' => '(listing_id)',
),
'doctor_callback' => array( $this, 'doctor_check' ),
)
);
}
/**
* Sync wp_comments → shadow table on insert.
*
* Bound during `on_register_event_hooks()`. The comment-router uses
* the shadow table for "is favorited" lookups; sync keeps it consistent.
*/
public function on_register_event_hooks(): void {
add_action( 'wp_insert_comment', array( $this, 'mirror_insert' ), 10, 2 );
add_action( 'deleted_comment', array( $this, 'mirror_delete' ), 10, 2 );
}
/**
* Mirror a newly-inserted hp_favorite into the shadow table.
*
* @param int $comment_id Comment ID.
* @param object|\WP_Comment $comment Comment object.
*/
public function mirror_insert( int $comment_id, $comment ): void {
if ( ! is_object( $comment ) || ( $comment->comment_type ?? '' ) !== self::COMMENT_TYPE ) {
return;
}
global $wpdb;
$user_id = (int) ( $comment->user_id ?? 0 );
$listing_id = (int) ( $comment->comment_post_ID ?? 0 );
if ( $user_id <= 0 || $listing_id <= 0 ) {
return;
}
$wpdb->query( // phpcs:ignore WordPress.DB.DirectDatabaseQuery, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
$wpdb->prepare(
'INSERT IGNORE INTO `' . $wpdb->prefix . self::TABLE . '` (comment_id, user_id, listing_id, created_at) VALUES (%d, %d, %d, %s)',
$comment_id,
$user_id,
$listing_id,
$comment->comment_date ?? current_time( 'mysql' )
)
);
}
/**
* Remove the shadow row when a hp_favorite comment is deleted.
*
* @param int $comment_id Comment ID.
* @param object|\WP_Comment $comment Comment object.
*/
public function mirror_delete( int $comment_id, $comment ): void {
if ( ! is_object( $comment ) || ( $comment->comment_type ?? '' ) !== self::COMMENT_TYPE ) {
return;
}
global $wpdb;
$wpdb->delete( // phpcs:ignore WordPress.DB.DirectDatabaseQuery
$wpdb->prefix . self::TABLE,
array( 'comment_id' => $comment_id ),
array( '%d' )
);
}
/**
* Doctor probe — verify shadow table exists.
*
* @return array{ok:bool, message:string, details?:array<string,mixed>}
*/
public function doctor_check(): array {
global $wpdb;
if ( ! isset( $wpdb ) || ! is_object( $wpdb ) ) {
return array(
'ok' => false,
'message' => 'wpdb global not available',
);
}
$table = $wpdb->prefix . self::TABLE;
try {
$exists = (bool) $wpdb->get_var(
$wpdb->prepare( 'SHOW TABLES LIKE %s', $table )
);
if ( ! $exists ) {
return array(
'ok' => false,
'message' => sprintf( 'hivepress-favorites: shadow table %s missing', $table ),
'details' => array( 'table' => $table ),
);
}
$rows = (int) $wpdb->get_var( "SELECT COUNT(*) FROM `{$table}`" ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
return array(
'ok' => true,
'message' => sprintf( 'hivepress-favorites: %s rows=%d', $table, $rows ),
'details' => array(
'table' => $table,
'rows' => $rows,
),
);
} catch ( \Throwable $e ) {
return array(
'ok' => false,
'message' => sprintf( 'hivepress-favorites doctor failed: %s', $e->getMessage() ),
);
}
}
/**
* 8-D self-score.
*
* D1: 1.0 — adapter never calls *_meta()
* D2: 1.0 — uses wpdb prefix, no hardcoded table literals
* D3: 1.0 — shadow table covers the model
* D4: 1.0 — expected_columns + indexes registered
* D5: 1.0 — listens to wp_insert_comment for cross-write consistency
* D6: 1.0 — zero options/transients
* D7: 1.0 — only queries own shadow table
* D8: 1.0 — UNIQUE(user_id, listing_id) covering index
*/
public function suitability_score(): array {
return $this->compose_score( array() );
}
/**
* FSM modules this adapter contributes.
*
* @return array<int,string>
*/
public function migrations(): array {
return array( 'comment_hp_favorite' );
}
}
} // end if ( ! class_exists )
@@ -3,28 +3,12 @@
* Messages adapter — `hivepress-messages`.
*
* The Message model extends Comment (`comment_type = hp_message`) and stores
* the recipient_id in `comment_karma` — a creative re-use of an unused column,
* but it leaves the field unindexed for "messages received by user N"
* queries. Result: every dashboard "unread count" badge does an O(N)
* `WHERE comment_type = 'hp_message' AND comment_karma = N` scan over
* the entire wp_comments table.
* the recipient in `comment_karma`, the sender in `user_id` and the read flag
* in `comment_approved`.
*
* Fix: shadow table `wp_wpdo_comment_hp_message` with proper recipient_id
* column + index. Adapter mirrors every hp_message write into the shadow,
* and the comment-router rewrites recipient/unread queries to hit the index.
*
* Schema:
*
* CREATE TABLE wp_wpdo_comment_hp_message (
* comment_id BIGINT UNSIGNED NOT NULL PRIMARY KEY,
* sender_id BIGINT UNSIGNED NOT NULL,
* recipient_id BIGINT UNSIGNED NOT NULL,
* listing_id BIGINT UNSIGNED NOT NULL,
* is_read TINYINT(1) NOT NULL DEFAULT 0,
* sent_at DATETIME NOT NULL,
* KEY idx_recipient_unread (recipient_id, is_read),
* KEY idx_thread (listing_id, sent_at)
* );
* Nothing is stored in comment meta, so there is no EAV surface to flatten:
* the adapter only reports detection and doctor status. (It used to mirror
* messages into `wpdo_comment_hp_message`, a table nothing ever created.)
*
* @package WP_Data_Optimizer
* @since 3.0.0
@@ -37,18 +21,15 @@ if ( ! defined( 'ABSPATH' ) ) {
if ( ! class_exists( 'TMDO_HivePress_Messages_Adapter' ) ) {
/**
* Messages addon adapter.
* Messages addon adapter (detection and doctor only).
*/
final class TMDO_HivePress_Messages_Adapter implements TMDO_HivePress_Adapter {
use TMDO_HivePress_Adapter_Trait;
/** Comment_type owned by this adapter. */
/** Comment_type of the Message model. */
public const COMMENT_TYPE = 'hp_message';
/** Shadow table name (without wpdb prefix). */
public const TABLE = 'wpdo_comment_hp_message';
/**
* Constructor — bind register hooks via inherited trait.
*/
@@ -75,189 +56,6 @@ if ( ! class_exists( 'TMDO_HivePress_Messages_Adapter' ) ) {
public function minimum_addon_version(): string {
return '1.4.0';
}
/**
* Declare the shadow table to the Custom_Table_Registry.
*
* @param TMDO_Custom_Table_Registry $registry Registry singleton.
*/
public function on_register_custom_tables( TMDO_Custom_Table_Registry $registry ): void {
$this->register_custom_table(
$registry,
array(
'table_name' => self::TABLE,
'primary_key' => 'comment_id',
'post_type_link' => null,
'expected_columns' => array(
'comment_id' => 'BIGINT UNSIGNED NOT NULL PRIMARY KEY',
'sender_id' => 'BIGINT UNSIGNED NOT NULL',
'recipient_id' => 'BIGINT UNSIGNED NOT NULL',
'listing_id' => 'BIGINT UNSIGNED NOT NULL',
'is_read' => 'TINYINT(1) NOT NULL DEFAULT 0',
'sent_at' => 'DATETIME NOT NULL',
),
'indexes' => array(
'idx_recipient_unread' => '(recipient_id, is_read)',
'idx_thread' => '(listing_id, sent_at)',
),
'doctor_callback' => array( $this, 'doctor_check' ),
)
);
}
/**
* Bind sync hooks on hp_message comment insert / update / delete.
*
* The recipient_id is stored in comment_karma by HivePress; we mirror
* it into a properly-named indexed column. is_read tracks comment_approved
* (HP uses 0=unread / 1=read) — same column, mirrored.
*/
public function on_register_event_hooks(): void {
add_action( 'wp_insert_comment', array( $this, 'mirror_insert' ), 10, 2 );
add_action( 'wp_set_comment_status', array( $this, 'mirror_status_change' ), 10, 2 );
add_action( 'deleted_comment', array( $this, 'mirror_delete' ), 10, 2 );
}
/**
* Mirror a new hp_message into the shadow table.
*
* @param int $comment_id Comment ID.
* @param object|\WP_Comment $comment Comment object.
*/
public function mirror_insert( int $comment_id, $comment ): void {
if ( ! is_object( $comment ) || ( $comment->comment_type ?? '' ) !== self::COMMENT_TYPE ) {
return;
}
global $wpdb;
$sender_id = (int) ( $comment->user_id ?? 0 );
$recipient_id = (int) ( $comment->comment_karma ?? 0 );
$listing_id = (int) ( $comment->comment_post_ID ?? 0 );
$is_read = (int) ( $comment->comment_approved ?? 0 );
if ( $sender_id <= 0 || $recipient_id <= 0 ) {
// Malformed message — nothing useful to mirror.
return;
}
$wpdb->query( // phpcs:ignore WordPress.DB.DirectDatabaseQuery, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
$wpdb->prepare(
'INSERT INTO `' . $wpdb->prefix . self::TABLE . '` (comment_id, sender_id, recipient_id, listing_id, is_read, sent_at) VALUES (%d, %d, %d, %d, %d, %s) ON DUPLICATE KEY UPDATE is_read = VALUES(is_read)',
$comment_id,
$sender_id,
$recipient_id,
$listing_id,
$is_read,
$comment->comment_date ?? current_time( 'mysql' )
)
);
}
/**
* Update is_read when a message is marked read (comment_approved flip).
*
* @param int $comment_id Comment ID.
* @param string $status New status ('approve', 'hold', 'spam', 'trash').
*/
public function mirror_status_change( int $comment_id, string $status ): void {
global $wpdb;
// Look up the comment to confirm it's hp_message before touching.
if ( ! function_exists( 'get_comment' ) ) {
return;
}
$comment = get_comment( $comment_id );
if ( ! $comment || ( $comment->comment_type ?? '' ) !== self::COMMENT_TYPE ) {
return;
}
$is_read = ( 'approve' === $status ) ? 1 : 0;
$wpdb->update( // phpcs:ignore WordPress.DB.DirectDatabaseQuery
$wpdb->prefix . self::TABLE,
array( 'is_read' => $is_read ),
array( 'comment_id' => $comment_id ),
array( '%d' ),
array( '%d' )
);
}
/**
* Remove shadow row on hp_message deletion.
*
* @param int $comment_id Comment ID.
* @param object|\WP_Comment $comment Comment object.
*/
public function mirror_delete( int $comment_id, $comment ): void {
if ( ! is_object( $comment ) || ( $comment->comment_type ?? '' ) !== self::COMMENT_TYPE ) {
return;
}
global $wpdb;
$wpdb->delete( // phpcs:ignore WordPress.DB.DirectDatabaseQuery
$wpdb->prefix . self::TABLE,
array( 'comment_id' => $comment_id ),
array( '%d' )
);
}
/**
* Doctor probe — verify shadow table.
*
* @return array{ok:bool, message:string, details?:array<string,mixed>}
*/
public function doctor_check(): array {
global $wpdb;
if ( ! isset( $wpdb ) || ! is_object( $wpdb ) ) {
return array(
'ok' => false,
'message' => 'wpdb global not available',
);
}
$table = $wpdb->prefix . self::TABLE;
try {
$exists = (bool) $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $table ) );
if ( ! $exists ) {
return array(
'ok' => false,
'message' => sprintf( 'hivepress-messages: shadow table %s missing', $table ),
'details' => array( 'table' => $table ),
);
}
$rows = (int) $wpdb->get_var( "SELECT COUNT(*) FROM `{$table}`" ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
return array(
'ok' => true,
'message' => sprintf( 'hivepress-messages: %s rows=%d', $table, $rows ),
'details' => array(
'table' => $table,
'rows' => $rows,
),
);
} catch ( \Throwable $e ) {
return array(
'ok' => false,
'message' => sprintf( 'hivepress-messages doctor failed: %s', $e->getMessage() ),
);
}
}
/**
* 8-D self-score.
*
* D1: 1.0 — adapter never calls *_meta()
* D2: 1.0 — uses wpdb prefix exclusively
* D3: 1.0 — shadow table covers recipient/unread access
* D4: 1.0 — expected_columns + indexes registered
* D5: 1.0 — listens to wp_insert_comment + status change for sync
* D6: 1.0 — zero options/transients
* D7: 1.0 — only queries own shadow table
* D8: 1.0 — idx_recipient_unread covers the hot dashboard query
*/
public function suitability_score(): array {
return $this->compose_score( array() );
}
/**
* FSM modules this adapter contributes.
*
* @return array<int,string>
*/
public function migrations(): array {
return array( 'comment_hp_message' );
}
}
} // end if ( ! class_exists )
@@ -9,21 +9,9 @@
* — same access pattern as Listing (user dashboard + expiry cron)
*
* - Offer (comment_type=hp_offer, parent post_type=hp_request)
* comment-column based; benefit comes from comment-router using
* (comment_post_ID, comment_type) covering index + dedicated shadow
* table for "approved offers per request" aggregation.
*
* Shadow table for offers (analogous to favorites pattern):
*
* CREATE TABLE wp_wpdo_comment_hp_offer (
* comment_id BIGINT UNSIGNED NOT NULL PRIMARY KEY,
* request_id BIGINT UNSIGNED NOT NULL,
* bidder_id BIGINT UNSIGNED NOT NULL,
* approved TINYINT(1) NOT NULL DEFAULT 0,
* created_at DATETIME NOT NULL,
* KEY idx_request_approved (request_id, approved),
* KEY idx_bidder (bidder_id)
* );
* stored in comment columns only — no comment meta to flatten.
* (The adapter used to mirror offers into `wpdo_comment_hp_offer`,
* a table nothing ever created.)
*
* @package WP_Data_Optimizer
* @since 3.0.0
@@ -45,9 +33,6 @@ if ( ! class_exists( 'TMDO_HivePress_Requests_Adapter' ) ) {
/** Comment_type for the Offer side of Requests. */
public const OFFER_COMMENT_TYPE = 'hp_offer';
/** Shadow table for offers (without wpdb prefix). */
public const OFFER_TABLE = 'wpdo_comment_hp_offer';
/**
* Constructor — bind register hooks via inherited trait.
*/
@@ -105,104 +90,7 @@ if ( ! class_exists( 'TMDO_HivePress_Requests_Adapter' ) ) {
}
/**
* Declare offer shadow table.
*
* @param TMDO_Custom_Table_Registry $registry Registry singleton.
*/
public function on_register_custom_tables( TMDO_Custom_Table_Registry $registry ): void {
$this->register_custom_table(
$registry,
array(
'table_name' => self::OFFER_TABLE,
'primary_key' => 'comment_id',
'post_type_link' => 'hp_request',
'expected_columns' => array(
'comment_id' => 'BIGINT UNSIGNED NOT NULL PRIMARY KEY',
'request_id' => 'BIGINT UNSIGNED NOT NULL',
'bidder_id' => 'BIGINT UNSIGNED NOT NULL',
'approved' => 'TINYINT(1) NOT NULL DEFAULT 0',
'created_at' => 'DATETIME NOT NULL',
),
'indexes' => array(
'idx_request_approved' => '(request_id, approved)',
'idx_bidder' => '(bidder_id)',
),
'doctor_callback' => array( $this, 'doctor_check' ),
)
);
}
/**
* Mirror new hp_offer comments into the shadow table.
*/
public function on_register_event_hooks(): void {
add_action( 'wp_insert_comment', array( $this, 'mirror_offer_insert' ), 10, 2 );
add_action( 'edit_comment', array( $this, 'mirror_offer_update' ), 10, 2 );
add_action( 'deleted_comment', array( $this, 'mirror_offer_delete' ), 10, 2 );
}
/**
* Insert a hp_offer mirror row.
*
* @param int $comment_id Comment ID.
* @param object|\WP_Comment $comment Comment object.
*/
public function mirror_offer_insert( int $comment_id, $comment ): void {
if ( ! is_object( $comment ) || ( $comment->comment_type ?? '' ) !== self::OFFER_COMMENT_TYPE ) {
return;
}
global $wpdb;
$wpdb->query( // phpcs:ignore WordPress.DB.DirectDatabaseQuery, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
$wpdb->prepare(
'INSERT INTO `' . $wpdb->prefix . self::OFFER_TABLE . '` (comment_id, request_id, bidder_id, approved, created_at) VALUES (%d, %d, %d, %d, %s) ON DUPLICATE KEY UPDATE approved = VALUES(approved)',
$comment_id,
(int) ( $comment->comment_post_ID ?? 0 ),
(int) ( $comment->user_id ?? 0 ),
(int) ( $comment->comment_approved ?? 0 ),
$comment->comment_date ?? current_time( 'mysql' )
)
);
}
/**
* Update mirror row when comment is edited (approval flip is the hot path).
*
* @param int $comment_id Comment ID.
* @param array $data Comment data array passed by edit_comment.
*/
public function mirror_offer_update( int $comment_id, $data ): void {
unset( $data );
global $wpdb;
// Re-fetch comment object for accurate state then re-mirror via insert path.
if ( function_exists( 'get_comment' ) ) {
$comment = get_comment( $comment_id );
if ( $comment ) {
$this->mirror_offer_insert( $comment_id, $comment );
}
}
unset( $wpdb );
}
/**
* Remove mirror row on hp_offer deletion.
*
* @param int $comment_id Comment ID.
* @param object|\WP_Comment $comment Comment object.
*/
public function mirror_offer_delete( int $comment_id, $comment ): void {
if ( ! is_object( $comment ) || ( $comment->comment_type ?? '' ) !== self::OFFER_COMMENT_TYPE ) {
return;
}
global $wpdb;
$wpdb->delete( // phpcs:ignore WordPress.DB.DirectDatabaseQuery
$wpdb->prefix . self::OFFER_TABLE,
array( 'comment_id' => $comment_id ),
array( '%d' )
);
}
/**
* Doctor probe — request hot table + offer shadow table.
* Doctor probe — request hot table.
*
* @return array{ok:bool, message:string, details?:array<string,mixed>}
*/
@@ -214,41 +102,21 @@ if ( ! class_exists( 'TMDO_HivePress_Requests_Adapter' ) ) {
'message' => 'wpdb global not available',
);
}
$details = array();
$ok = true;
foreach ( array(
'hp_request_hot' => $wpdb->prefix . 'wpdo_hot_hp_request',
'hp_offer_shadow' => $wpdb->prefix . self::OFFER_TABLE,
) as $key => $table ) {
try {
$exists = (bool) $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $table ) );
$details[ $key ] = array(
'table' => $table,
'exists' => $exists,
);
if ( ! $exists ) {
$ok = false;
}
} catch ( \Throwable $e ) {
$details[ $key ] = array(
'table' => $table,
'error' => $e->getMessage(),
);
$ok = false;
}
$table = $wpdb->prefix . 'wpdo_hot_hp_request';
try {
$exists = (bool) $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $table ) );
return array(
'ok' => $exists,
'message' => $exists
? sprintf( 'hivepress-requests: %s present', $table )
: sprintf( 'hivepress-requests: %s missing', $table ),
);
} catch ( \Throwable $e ) {
return array(
'ok' => false,
'message' => sprintf( 'hivepress-requests doctor failed: %s', $e->getMessage() ),
);
}
return array(
'ok' => $ok,
'message' => $ok ? 'hivepress-requests: tables OK' : 'hivepress-requests: one or more tables missing',
'details' => $details,
);
}
/**
* 8-D self-score.
*/
public function suitability_score(): array {
return $this->compose_score( array() );
}
/**
@@ -257,10 +125,7 @@ if ( ! class_exists( 'TMDO_HivePress_Requests_Adapter' ) ) {
* @return array<int,string>
*/
public function migrations(): array {
return array(
'hot_hp_request',
'comment_hp_offer',
);
return array( 'hot_hp_request' );
}
}
@@ -10,14 +10,12 @@
* - approved → comment_approved
* - listing → comment_post_ID
*
* No postmeta is used; no entity-bridge group needed. Hot-path optimization
* comes from `TMDO_HivePress_Comment_Router` rewriting comment-query SQL to
* use `comment_post_ID + comment_type + comment_approved` index, and from
* the `wp_wpdo_comment_hp_review` flat table that WPDO Comment entity bridge
* already maintains (since v2.13.x).
* No postmeta is used; no entity-bridge group needed. Queries use the core
* `wp_comments` indexes on `comment_post_ID` / `comment_type`, and the
* `wp_wpdo_comment_hp_review` flat table is maintained by the WPDO Comment
* entity bridge (since v2.13.x).
*
* This adapter's role:
* - Declare the comment_type to the comment-router
* - Doctor probe of the entity-bridge table
* - Self-report 8-D suitability score
*
@@ -124,7 +122,7 @@ if ( ! class_exists( 'TMDO_HivePress_Reviews_Adapter' ) ) {
* D5: 1.0 — no cross-adapter writes needed yet
* D6: 1.0 — zero options/transients written
* D7: 1.0 — only queries own entity-bridge table
* D8: 1.0 — comment-router uses (comment_post_ID, comment_type) covering index
* D8: 1.0 — reads use the core wp_comments (comment_post_ID, comment_type) indexes
*/
public function suitability_score(): array {
return $this->compose_score( array() );