bind_anti_eav_hooks(); } /** Adapter slug (matches wp.org plugin slug). */ public function plugin_slug(): string { return 'hivepress-marketplace'; } /** Class probed for addon presence. */ public function detection_class(): string { return 'HivePress\\Marketplace\\Plugin'; } /** Version constant probed for addon presence. */ public function detection_const(): string { return 'HIVEPRESS_MARKETPLACE_VERSION'; } /** Minimum addon version supported. */ public function minimum_addon_version(): string { return '1.0.0'; } /** * Register marketplace hot fields on the listing post type. * * @param TMDO_Schema_Registry $registry Schema registry singleton. */ public function on_register_fields( TMDO_Schema_Registry $registry ): void { $registry->register_many( $this->plugin_slug(), array( array( 'post_type' => 'hp_listing', 'meta_key' => 'hp_purchase_price', 'zone' => 'hot', 'data_type' => 'decimal(10,2) DEFAULT NULL', 'column' => 'hp_purchase_price', 'indexed' => true, ), array( 'post_type' => 'hp_listing', 'meta_key' => 'hp_purchase_count', 'zone' => 'warm', 'ttl' => null, ), ) ); } /** * Doctor probe — verify hot column exists on listing hot table. * * @return array{ok:bool, message:string} */ 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 . 'wpdo_hot_hp_listing'; try { $exists = (bool) $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $table ) ); return array( 'ok' => $exists, 'message' => $exists ? 'hivepress-marketplace: shares wp_wpdo_hot_hp_listing' : 'hivepress-marketplace: hot listing table missing', ); } catch ( \Throwable $e ) { return array( 'ok' => false, 'message' => sprintf( 'hivepress-marketplace doctor failed: %s', $e->getMessage() ), ); } } /** * 8-D self-score. * * D8 reduced to 0.9 — index assumption is best-effort until addon installs. */ public function suitability_score(): array { return $this->compose_score( array( 'd8_perf' => 0.9, ) ); } } } // end if ( ! class_exists )