bind_anti_eav_hooks(); } /** Adapter slug (matches wp.org plugin slug). */ public function plugin_slug(): string { return 'hivepress-bookings'; } /** Class probed for addon presence. */ public function detection_class(): string { return 'HivePress\\Bookings\\Plugin'; } /** Version constant probed for addon presence. */ public function detection_const(): string { return 'HIVEPRESS_BOOKINGS_VERSION'; } /** Minimum addon version supported. */ public function minimum_addon_version(): string { return '1.0.0'; } /** * Register hot fields for hp_booking 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_booking', 'meta_key' => 'hp_start_time', 'zone' => 'hot', 'data_type' => 'bigint(20) UNSIGNED NOT NULL DEFAULT 0', 'column' => 'hp_start_time', 'indexed' => true, ), array( 'post_type' => 'hp_booking', 'meta_key' => 'hp_end_time', 'zone' => 'hot', 'data_type' => 'bigint(20) UNSIGNED NOT NULL DEFAULT 0', 'column' => 'hp_end_time', 'indexed' => true, ), array( 'post_type' => 'hp_booking', 'meta_key' => 'hp_guests', 'zone' => 'hot', 'data_type' => 'int(11) NOT NULL DEFAULT 0', 'column' => 'hp_guests', 'indexed' => false, ), ) ); } /** * Doctor probe — verify hot table when addon is active. * * @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_booking'; try { $exists = (bool) $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $table ) ); return array( 'ok' => $exists, 'message' => $exists ? sprintf( 'hivepress-bookings: %s present', $table ) : sprintf( 'hivepress-bookings: %s missing (addon installed but not migrated)', $table ), ); } catch ( \Throwable $e ) { return array( 'ok' => false, 'message' => sprintf( 'hivepress-bookings doctor failed: %s', $e->getMessage() ), ); } } /** * 8-D self-score. * * D8 (perf) reduced to 0.9 because the schema is best-effort from * documentation; once the addon is installed and EXPLAIN can verify * index usage, raise to 1.0. */ public function suitability_score(): array { return $this->compose_score( array( 'd8_perf' => 0.9, ) ); } /** * FSM modules this adapter contributes. * * @return array */ public function migrations(): array { return array( 'hot_hp_booking' ); } } } // end if ( ! class_exists )