bind_anti_eav_hooks(); } /** Adapter slug (matches wp.org plugin slug). */ public function plugin_slug(): string { return 'hivepress-reviews'; } /** Class probed for addon presence. */ public function detection_class(): string { return 'HivePress\\Reviews\\Plugin'; } /** Version constant probed for addon presence. */ public function detection_const(): string { return 'HIVEPRESS_REVIEWS_VERSION'; } /** Minimum addon version supported. */ public function minimum_addon_version(): string { return '1.4.0'; } /** * Doctor probe — verify entity-bridge table exists and is reachable. * * @return array{ok:bool, message:string, details?:array} */ 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-reviews: %s missing (Comment entity-bridge not migrated)', $table ), 'details' => array( 'table' => $table ), ); } $rows = (int) $wpdb->get_var( "SELECT COUNT(*) FROM `{$table}`" ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Sanitized via wpdb prefix. return array( 'ok' => true, 'message' => sprintf( 'hivepress-reviews: %s rows=%d', $table, $rows ), 'details' => array( 'table' => $table, 'rows' => $rows, ), ); } catch ( \Throwable $e ) { return array( 'ok' => false, 'message' => sprintf( 'hivepress-reviews doctor failed: %s', $e->getMessage() ), ); } } /** * 8-D self-score. * * D1: 1.0 — adapter never calls *_meta() (Review is comment-column based) * D2: 1.0 — no hardcoded wp_comments references; uses wpdb prefix * D3: 1.0 — entity-bridge table covers the model * D4: 1.0 — table schema owned by Comment entity adapter (already documented) * 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 */ public function suitability_score(): array { return $this->compose_score( array() ); } /** * FSM modules contributed (none — comment entity-bridge owns lifecycle). * * @return array */ public function migrations(): array { return array( // Comment entity-bridge migration is module 'comment_hp_review', // owned by TMDO_Migration_Orchestrator — adapter is read-only. ); } } } // end if ( ! class_exists )