From c71e5f6a8d7ecf7919219052713eb1dbd4dcf9b7 Mon Sep 17 00:00:00 2001 From: Jan Jakes Date: Fri, 25 Jul 2025 13:14:33 +0200 Subject: [PATCH 1/2] Add missing "global" definition --- integrations/query-monitor/boot.php | 1 + 1 file changed, 1 insertion(+) diff --git a/integrations/query-monitor/boot.php b/integrations/query-monitor/boot.php index 83c42672..ea8d2984 100644 --- a/integrations/query-monitor/boot.php +++ b/integrations/query-monitor/boot.php @@ -56,6 +56,7 @@ } } +global $wpdb; if ( ! isset( $wpdb ) ) { return; } From 9e4cc6faa0f04071be7a58836646b021b00838dc Mon Sep 17 00:00:00 2001 From: Jan Jakes Date: Fri, 25 Jul 2025 13:16:20 +0200 Subject: [PATCH 2/2] Register SQLite enhancements for Query Monitor when booting it, not in the plugin This makes the enhancements work in WordPress Playground, as Playground only loads the SQLite driver and not all of the SQLite Database Inegration plugin. --- integrations/query-monitor/boot.php | 9 +++++++++ load.php | 5 ----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/integrations/query-monitor/boot.php b/integrations/query-monitor/boot.php index ea8d2984..629ef10f 100644 --- a/integrations/query-monitor/boot.php +++ b/integrations/query-monitor/boot.php @@ -125,3 +125,12 @@ // 5. Mark the Query Monitor integration as loaded. define( 'SQLITE_QUERY_MONITOR_LOADED', true ); + +// 6. Register the SQLite enhancements for Query Monitor. +function register_sqlite_enhancements_for_query_monitor() { + require_once __DIR__ . '/plugin.php'; +} + +if ( function_exists( 'add_action' ) ) { + add_action( 'plugins_loaded', 'register_sqlite_enhancements_for_query_monitor' ); +} diff --git a/load.php b/load.php index d94bd95b..29f1dcef 100644 --- a/load.php +++ b/load.php @@ -26,8 +26,3 @@ require_once __DIR__ . '/deactivate.php'; require_once __DIR__ . '/admin-notices.php'; require_once __DIR__ . '/health-check.php'; - -// Query Monitor integration: -if ( defined( 'SQLITE_QUERY_MONITOR_LOADED' ) && SQLITE_QUERY_MONITOR_LOADED ) { - require_once __DIR__ . '/integrations/query-monitor/plugin.php'; -}