bind_anti_eav_hooks(); } /** Adapter slug (matches wp.org plugin slug). */ public function plugin_slug(): string { return 'hivepress-statistics'; } /** Class probed for addon presence. */ public function detection_class(): string { return 'HivePress\\Statistics\\Plugin'; } /** Version constant probed for addon presence. */ public function detection_const(): string { return 'HIVEPRESS_STATISTICS_VERSION'; } /** Minimum addon version supported. */ public function minimum_addon_version(): string { return '1.0.0'; } /** * Register counter fields to warm zone. * * @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_view_count', 'zone' => 'warm', 'ttl' => null, ), array( 'post_type' => 'hp_listing', 'meta_key' => 'hp_click_count', 'zone' => 'warm', 'ttl' => null, ), ) ); } /** * Doctor probe — warm zone uses shared wp_wpdo_warm KV 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_warm'; try { $exists = (bool) $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $table ) ); return array( 'ok' => $exists, 'message' => $exists ? 'hivepress-statistics: warm zone (wpdo_warm) reachable' : 'hivepress-statistics: wpdo_warm missing', ); } catch ( \Throwable $e ) { return array( 'ok' => false, 'message' => sprintf( 'hivepress-statistics doctor failed: %s', $e->getMessage() ), ); } } /** * 8-D self-score — D8 reduced (warm zone is best-effort until addon installs). */ public function suitability_score(): array { return $this->compose_score( array( 'd8_perf' => 0.9, ) ); } } } // end if ( ! class_exists )