spool(); $stats = $spool->stats(); $since = gmdate( 'Y-m-d H:i:s', time() - 3600 ); $orders_last_hour = null; try { if ( class_exists( '\Automattic\WooCommerce\Utilities\OrderUtil' ) && \Automattic\WooCommerce\Utilities\OrderUtil::custom_orders_table_usage_is_enabled() ) { $orders_last_hour = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}wc_orders WHERE type = 'shop_order' AND date_created_gmt >= %s", $since ) ); // phpcs:ignore WordPress.DB } elseif ( class_exists( '\WooCommerce' ) ) { $orders_last_hour = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_type = 'shop_order' AND post_date_gmt >= %s", $since ) ); // phpcs:ignore WordPress.DB } } catch ( \Throwable ) { $orders_last_hour = null; } return array( 'wp_version' => get_bloginfo( 'version' ), 'php_version' => PHP_VERSION, 'woocommerce_version' => defined( 'WC_VERSION' ) ? (string) WC_VERSION : null, 'subscriptions_version' => class_exists( '\WC_Subscriptions' ) && isset( \WC_Subscriptions::$version ) ? (string) \WC_Subscriptions::$version : null, 'object_cache' => wp_using_ext_object_cache(), 'debug' => defined( 'WP_DEBUG' ) && WP_DEBUG, 'cron' => array( 'disabled' => defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON, 'next_operanse_collect' => wp_next_scheduled( 'operanse_collect' ) ?: null ), 'memory_limit' => (string) ini_get( 'memory_limit' ), 'agent' => array( 'version' => OPERANSE_AGENT_VERSION, 'connection_mode' => $this->settings->connection_mode(), 'spool_tier' => $spool->tier(), 'spool_bytes' => $stats['bytes'], 'dropped' => $stats['dropped'], 'last_flush_at' => (int) $this->settings->get( 'last_flush_at', 0 ) ?: null, 'last_flush_ok' => $this->settings->get( 'last_flush_ok' ), // Redacted again on the way out, for a value a build before 0.6.6 stored unredacted. 'last_error' => Redactor::error_message( (string) $this->settings->get( 'last_error', '' ) ), ), 'orders_last_hour' => $orders_last_hour, 'now' => gmdate( 'Y-m-d\TH:i:s\Z' ), ); } }