Query Monitor - Version 2.8.1

Version Description

  • Correctly detect the file name and line number responsible for loading translation files in plugins which use load_textdomain().
  • Correct the visibility of the before_output() method in the REST dispatcher.
  • Load the languages collector early so it catches plugins which load their translation files when they initialise.
  • Remove an erroneous double quote.
  • Remove connection as param in mysqli_get_client_version().
  • Various CSS fixes.
Download this release

Release Info

Developer johnbillion
Plugin Icon 128x128 Query Monitor
Version 2.8.1
Comparing to
See all releases

Code changes from version 2.8.0 to 2.8.1

assets/query-monitor.css CHANGED
@@ -205,7 +205,7 @@ body.wp-admin.folded #qm {
205
  background: #fff !important;
206
  box-sizing: border-box !important;
207
  text-align: left !important;
208
- font-family: Menlo, Monaco, Consolas, 'Courier New', monospace !important;
209
  font-size: 11px !important;
210
  font-weight: normal !important;
211
  font-style: normal !important;
@@ -215,7 +215,6 @@ body.wp-admin.folded #qm {
215
  vertical-align: top !important;
216
  text-shadow: none !important;
217
  text-transform: none !important;
218
- position: relative !important;
219
  }
220
 
221
  .qm .qm-totally-legit-spacer td {
@@ -253,6 +252,15 @@ body.wp-admin.folded #qm {
253
  text-align: right !important;
254
  }
255
 
 
 
 
 
 
 
 
 
 
256
  .qm .qm-inner-toggle {
257
  padding: 5px 8px 4px !important;
258
  }
@@ -270,6 +278,7 @@ body.wp-admin.folded #qm {
270
  width: 100% !important;
271
  }
272
 
 
273
  .qm td.qm-has-inner {
274
  padding: 0 !important;
275
  }
@@ -291,7 +300,7 @@ body.wp-admin.folded #qm {
291
  }
292
 
293
  .qm pre {
294
- font-family: Menlo, Monaco, Consolas, 'Courier New', monospace !important;
295
  font-size: 11px !important;
296
  font-weight: normal !important;
297
  font-style: normal !important;
@@ -304,7 +313,7 @@ body.wp-admin.folded #qm {
304
  }
305
 
306
  .qm code {
307
- font-family: Menlo, Monaco, Consolas, 'Courier New', monospace !important;
308
  font-size: 11px !important;
309
  font-weight: normal !important;
310
  font-style: normal !important;
@@ -408,7 +417,7 @@ body.wp-admin.folded #qm {
408
 
409
  select.qm-filter {
410
  display: block !important;
411
- font-family: Menlo, Monaco, Consolas, 'Courier New', monospace !important;
412
  font-weight: normal !important;
413
  font-size: 10px !important;
414
  margin: 4px 0 2px !important;
@@ -510,7 +519,7 @@ html[dir="rtl"] .qm th {
510
  margin: 4px 0 !important;
511
  color: inherit !important;
512
  background: transparent !important;
513
- font-family: Menlo, Monaco, Consolas, 'Courier New', monospace !important;
514
  }
515
 
516
  .qm-debug-bar textarea {
@@ -526,7 +535,7 @@ html[dir="rtl"] .qm th {
526
  }
527
 
528
  .qm-debug-bar h1, .qm-debug-bar h2, .qm-debug-bar h3 {
529
- font-family: Menlo, Monaco, Consolas, 'Courier New', monospace !important;
530
  font-weight: normal !important;
531
  }
532
 
205
  background: #fff !important;
206
  box-sizing: border-box !important;
207
  text-align: left !important;
208
+ font-family: Menlo, Monaco, Consolas, monospace !important;
209
  font-size: 11px !important;
210
  font-weight: normal !important;
211
  font-style: normal !important;
215
  vertical-align: top !important;
216
  text-shadow: none !important;
217
  text-transform: none !important;
 
218
  }
219
 
220
  .qm .qm-totally-legit-spacer td {
252
  text-align: right !important;
253
  }
254
 
255
+ .qm td.qm-has-toggle {
256
+ padding: 0 !important;
257
+ }
258
+
259
+ .qm td .qm-toggler {
260
+ padding: 5px 8px 4px !important;
261
+ position: relative !important;
262
+ }
263
+
264
  .qm .qm-inner-toggle {
265
  padding: 5px 8px 4px !important;
266
  }
278
  width: 100% !important;
279
  }
280
 
281
+ .qm td.qm-has-inner .qm-toggler,
282
  .qm td.qm-has-inner {
283
  padding: 0 !important;
284
  }
300
  }
301
 
302
  .qm pre {
303
+ font-family: Menlo, Monaco, Consolas, monospace !important;
304
  font-size: 11px !important;
305
  font-weight: normal !important;
306
  font-style: normal !important;
313
  }
314
 
315
  .qm code {
316
+ font-family: Menlo, Monaco, Consolas, monospace !important;
317
  font-size: 11px !important;
318
  font-weight: normal !important;
319
  font-style: normal !important;
417
 
418
  select.qm-filter {
419
  display: block !important;
420
+ font-family: Menlo, Monaco, Consolas, monospace !important;
421
  font-weight: normal !important;
422
  font-size: 10px !important;
423
  margin: 4px 0 2px !important;
519
  margin: 4px 0 !important;
520
  color: inherit !important;
521
  background: transparent !important;
522
+ font-family: Menlo, Monaco, Consolas, monospace !important;
523
  }
524
 
525
  .qm-debug-bar textarea {
535
  }
536
 
537
  .qm-debug-bar h1, .qm-debug-bar h2, .qm-debug-bar h3 {
538
+ font-family: Menlo, Monaco, Consolas, monospace !important;
539
  font-weight: normal !important;
540
  }
541
 
collectors/environment.php CHANGED
@@ -126,7 +126,7 @@ class QM_Collector_Environment extends QM_Collector {
126
  }
127
 
128
  if ( isset( $db->use_mysqli ) && $db->use_mysqli ) {
129
- $client = mysqli_get_client_version( $db->dbh );
130
  } else {
131
  if ( preg_match( '|[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}|', mysql_get_client_info(), $matches ) ) {
132
  $client = $matches[0];
126
  }
127
 
128
  if ( isset( $db->use_mysqli ) && $db->use_mysqli ) {
129
+ $client = mysqli_get_client_version();
130
  } else {
131
  if ( preg_match( '|[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}|', mysql_get_client_info(), $matches ) ) {
132
  $client = $matches[0];
collectors/languages.php CHANGED
@@ -63,7 +63,16 @@ class QM_Collector_Languages extends QM_Collector {
63
  }
64
 
65
  if ( empty( $caller ) ) {
66
- $caller = $filtered[1];
 
 
 
 
 
 
 
 
 
67
  }
68
 
69
  $this->data['languages'][] = array(
@@ -77,12 +86,7 @@ class QM_Collector_Languages extends QM_Collector {
77
 
78
  }
79
 
80
-
81
- }
82
-
83
- function register_qm_collector_languages( array $collectors, QueryMonitor $qm ) {
84
- $collectors['languages'] = new QM_Collector_Languages;
85
- return $collectors;
86
  }
87
 
88
- add_filter( 'qm/collectors', 'register_qm_collector_languages', 21, 2 );
 
63
  }
64
 
65
  if ( empty( $caller ) ) {
66
+ if ( isset( $filtered[1] ) ) {
67
+ $caller = $filtered[1];
68
+ } else {
69
+ $caller = $filtered[0];
70
+ }
71
+ }
72
+
73
+ if ( ! isset( $caller['file'] ) && isset( $filtered[0]['file'] ) && isset( $filtered[0]['line'] ) ) {
74
+ $caller['file'] = $filtered[0]['file'];
75
+ $caller['line'] = $filtered[0]['line'];
76
  }
77
 
78
  $this->data['languages'][] = array(
86
 
87
  }
88
 
 
 
 
 
 
 
89
  }
90
 
91
+ # Load early to catch early errors
92
+ QM_Collectors::add( new QM_Collector_Languages );
dispatchers/REST.php CHANGED
@@ -51,7 +51,7 @@ class QM_Dispatcher_REST extends QM_Dispatcher {
51
 
52
  }
53
 
54
- public function before_output() {
55
 
56
  require_once $this->qm->plugin_path( 'output/Headers.php' );
57
 
51
 
52
  }
53
 
54
+ protected function before_output() {
55
 
56
  require_once $this->qm->plugin_path( 'output/Headers.php' );
57
 
output/html/db_queries.php CHANGED
@@ -350,7 +350,7 @@ class QM_Output_Html_DB_Queries extends QM_Output_Html {
350
  }
351
 
352
  if ( isset( $cols['caller'] ) ) {
353
- echo "<td class='qm-row-caller qm-ltr qm-has-toggle qm-nowrap'>";
354
 
355
  echo $caller_name; // WPCS: XSS ok.
356
 
@@ -359,7 +359,7 @@ class QM_Output_Html_DB_Queries extends QM_Output_Html {
359
  echo '<div class="qm-toggled">' . implode( '<br>', $stack ) . '</div>'; // WPCS: XSS ok.
360
  }
361
 
362
- echo '</td>';
363
  }
364
 
365
  if ( isset( $cols['stack'] ) ) {
@@ -382,7 +382,7 @@ class QM_Output_Html_DB_Queries extends QM_Output_Html {
382
  }
383
 
384
  if ( isset( $cols['time'] ) ) {
385
- echo '<td class="qm-num qm-row-time"' . esc_attr( $td ) . '">'. esc_html( $stime ) . "</td>\n";
386
  }
387
 
388
  echo '</tr>';
350
  }
351
 
352
  if ( isset( $cols['caller'] ) ) {
353
+ echo "<td class='qm-row-caller qm-ltr qm-has-toggle qm-nowrap'><div class='qm-toggler'>";
354
 
355
  echo $caller_name; // WPCS: XSS ok.
356
 
359
  echo '<div class="qm-toggled">' . implode( '<br>', $stack ) . '</div>'; // WPCS: XSS ok.
360
  }
361
 
362
+ echo '</div></td>';
363
  }
364
 
365
  if ( isset( $cols['stack'] ) ) {
382
  }
383
 
384
  if ( isset( $cols['time'] ) ) {
385
+ echo '<td class="qm-num qm-row-time' . esc_attr( $td ) . '">'. esc_html( $stime ) . "</td>\n";
386
  }
387
 
388
  echo '</tr>';
output/html/overview.php CHANGED
@@ -32,7 +32,7 @@ class QM_Output_Html_Overview extends QM_Output_Html {
32
  if ( $db_queries ) {
33
  # @TODO: make this less derpy:
34
  $db_queries_data = $db_queries->get_data();
35
- if ( isset( $db_queries_data['types'] ) ) {
36
  $db_query_num = $db_queries_data['types'];
37
  }
38
  }
32
  if ( $db_queries ) {
33
  # @TODO: make this less derpy:
34
  $db_queries_data = $db_queries->get_data();
35
+ if ( isset( $db_queries_data['types'] ) && isset( $db_queries_data['total_time'] ) ) {
36
  $db_query_num = $db_queries_data['types'];
37
  }
38
  }
output/html/request.php CHANGED
@@ -102,7 +102,7 @@ class QM_Output_Html_Request extends QM_Output_Html {
102
 
103
  echo '<tr>';
104
  echo '<td>' . esc_html__( 'Queried Object', 'query-monitor' ) . '</td>';
105
- echo '<td colspan="2" class="qm-has-inner">';
106
 
107
  printf(
108
  '<div class="qm-inner-toggle">%1$s (%2$s) <a href="#" class="qm-toggle" data-on="+" data-off="-">+</a></div>',
@@ -114,7 +114,7 @@ class QM_Output_Html_Request extends QM_Output_Html {
114
  self::output_inner( $data['queried_object']['data'] );
115
  echo '</div>';
116
 
117
- echo '</td>';
118
  echo '</tr>';
119
 
120
  }
@@ -134,7 +134,7 @@ class QM_Output_Html_Request extends QM_Output_Html {
134
  echo '<tr>';
135
  }
136
 
137
- echo '<td colspan="2" class="qm-has-inner">';
138
 
139
  printf(
140
  '<div class="qm-inner-toggle">%1$s <a href="#" class="qm-toggle" data-on="+" data-off="-">+</a></div>',
@@ -145,7 +145,7 @@ class QM_Output_Html_Request extends QM_Output_Html {
145
  self::output_inner( $value['data'] );
146
  echo '</div>';
147
 
148
- echo '</td>';
149
 
150
  $first = false;
151
 
102
 
103
  echo '<tr>';
104
  echo '<td>' . esc_html__( 'Queried Object', 'query-monitor' ) . '</td>';
105
+ echo '<td colspan="2" class="qm-has-inner qm-has-toggle"><div class="qm-toggler">';
106
 
107
  printf(
108
  '<div class="qm-inner-toggle">%1$s (%2$s) <a href="#" class="qm-toggle" data-on="+" data-off="-">+</a></div>',
114
  self::output_inner( $data['queried_object']['data'] );
115
  echo '</div>';
116
 
117
+ echo '</div></td>';
118
  echo '</tr>';
119
 
120
  }
134
  echo '<tr>';
135
  }
136
 
137
+ echo '<td colspan="2" class="qm-has-inner qm-has-toggle"><div class="qm-toggler">';
138
 
139
  printf(
140
  '<div class="qm-inner-toggle">%1$s <a href="#" class="qm-toggle" data-on="+" data-off="-">+</a></div>',
145
  self::output_inner( $value['data'] );
146
  echo '</div>';
147
 
148
+ echo '</div></td>';
149
 
150
  $first = false;
151
 
query-monitor.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Query Monitor
4
  Description: Monitoring of database queries, hooks, conditionals and more.
5
- Version: 2.8.0
6
  Plugin URI: https://querymonitor.com/
7
  Author: John Blackbourn
8
  Author URI: https://johnblackbourn.com/
2
  /*
3
  Plugin Name: Query Monitor
4
  Description: Monitoring of database queries, hooks, conditionals and more.
5
+ Version: 2.8.1
6
  Plugin URI: https://querymonitor.com/
7
  Author: John Blackbourn
8
  Author URI: https://johnblackbourn.com/
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: johnbillion
3
  Tags: ajax, debug, debug-bar, debugging, development, developer, performance, profiler, profiling, queries, query monitor, rest-api
4
  Requires at least: 3.7
5
- Tested up to: 4.3
6
- Stable tag: 2.8.0
7
  License: GPLv2 or later
8
 
9
  View debugging and performance information on database queries, hooks, conditionals, HTTP requests, redirects and more.
@@ -163,6 +163,14 @@ No, I do not accept donations. If you like the plugin, I'd love for you to [leav
163
 
164
  == Changelog ==
165
 
 
 
 
 
 
 
 
 
166
  = 2.8.0 =
167
  * A new Languages component for debugging languages and text domains. Thanks, @MPolleke!
168
  * REST API debugging in the form of HTTP headers when performing an authenticated REST API request. Shows PHP errors when relevant, along with an overview of memory usage, processing time, database query number, and database query time.
2
  Contributors: johnbillion
3
  Tags: ajax, debug, debug-bar, debugging, development, developer, performance, profiler, profiling, queries, query monitor, rest-api
4
  Requires at least: 3.7
5
+ Tested up to: 4.4
6
+ Stable tag: 2.8.1
7
  License: GPLv2 or later
8
 
9
  View debugging and performance information on database queries, hooks, conditionals, HTTP requests, redirects and more.
163
 
164
  == Changelog ==
165
 
166
+ = 2.8.1 =
167
+ * Correctly detect the file name and line number responsible for loading translation files in plugins which use `load_textdomain()`.
168
+ * Correct the visibility of the `before_output()` method in the REST dispatcher.
169
+ * Load the languages collector early so it catches plugins which load their translation files when they initialise.
170
+ * Remove an erroneous double quote.
171
+ * Remove connection as param in `mysqli_get_client_version()`.
172
+ * Various CSS fixes.
173
+
174
  = 2.8.0 =
175
  * A new Languages component for debugging languages and text domains. Thanks, @MPolleke!
176
  * REST API debugging in the form of HTTP headers when performing an authenticated REST API request. Shows PHP errors when relevant, along with an overview of memory usage, processing time, database query number, and database query time.