false, 'message' => __( 'Query Monitor is not active on this site. Install and activate the Query Monitor plugin to use this ability.', 'acrossai-abilities-manager' ), ); } /** * Read one collector's processed data object, or null when unavailable. * * Calls the collector's own process() so derived fields (totals, duplicates, * the slowest queries) are populated; a bare get_data() returns the raw log. * * @param string $collector_id Query Monitor collector id, e.g. 'db_queries'. * @return object|null */ public static function collector_data( string $collector_id ) { if ( ! self::is_active() ) { return null; } try { $collector = \QM_Collectors::get( $collector_id ); if ( ! is_object( $collector ) || ! method_exists( $collector, 'get_data' ) ) { return null; } if ( method_exists( $collector, 'process' ) ) { $collector->process(); } $data = $collector->get_data(); return is_object( $data ) ? $data : null; } catch ( \Throwable $e ) { return null; } } }