Query Monitor - Version 2.6.8

Version Description

  • Misc minor bugfixes. Nothing to get excited about.

=

Download this release

Release Info

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

Code changes from version 2.6.7 to 2.6.8

Backtrace.php CHANGED
@@ -107,20 +107,20 @@ class QM_Backtrace {
107
 
108
  try {
109
 
110
- if ( isset( $item['file'] ) ) {
111
- $file = $item['file'];
112
- } else if ( isset( $item['class'] ) ) {
113
  if ( !is_object( $item['class'] ) and !class_exists( $item['class'], false ) )
114
  continue;
115
  if ( !method_exists( $item['class'], $item['function'] ) )
116
  continue;
117
  $ref = new ReflectionMethod( $item['class'], $item['function'] );
118
  $file = $ref->getFileName();
119
- } else {
120
- if ( !function_exists( $item['function'] ) )
121
- continue;
122
  $ref = new ReflectionFunction( $item['function'] );
123
  $file = $ref->getFileName();
 
 
 
 
124
  }
125
 
126
  $comp = QM_Util::get_file_component( $file );
107
 
108
  try {
109
 
110
+ if ( isset( $item['class'] ) ) {
 
 
111
  if ( !is_object( $item['class'] ) and !class_exists( $item['class'], false ) )
112
  continue;
113
  if ( !method_exists( $item['class'], $item['function'] ) )
114
  continue;
115
  $ref = new ReflectionMethod( $item['class'], $item['function'] );
116
  $file = $ref->getFileName();
117
+ } else if ( function_exists( $item['function'] ) ) {
 
 
118
  $ref = new ReflectionFunction( $item['function'] );
119
  $file = $ref->getFileName();
120
+ } else if ( isset( $item['file'] ) ) {
121
+ $file = $item['file'];
122
+ } else {
123
+ continue;
124
  }
125
 
126
  $comp = QM_Util::get_file_component( $file );
assets/query-monitor.css CHANGED
@@ -285,11 +285,6 @@ body.js #qm-wrapper {
285
  color: #ccc !important;
286
  }
287
 
288
- .qm span.qm-na,
289
- .qm tr.qm-na {
290
- color: #ccc !important;
291
- }
292
-
293
  .qm .qm-sql {
294
  word-wrap: break-word !important;
295
  word-break: break-all !important;
@@ -340,8 +335,7 @@ body.js #qm-wrapper {
340
  background: #eee !important;
341
  }
342
 
343
- .qm .qm-warn,
344
- .qm .qm-warn span.qm-na {
345
  color: #f00 !important;
346
  }
347
 
@@ -416,16 +410,28 @@ html[dir="rtl"] .qm-ltr {
416
  text-align: right !important;
417
  }
418
 
419
- html[dir="rtl"] .qm td.qm-priority {
420
- padding: 1px 0 1px 0.75em !important;
 
421
  }
422
 
423
- html[dir="rtl"] .qm td.qm-var {
424
- padding: 1px 0 1px 1.5em !important;
425
- text-align: left !important;
 
 
426
  }
427
 
428
- html[dir="rtl"] body:not(.iframe).sticky-menu #qm {
429
- margin-right: 150px !important;
430
  margin-left: 0 !important;
431
  }
 
 
 
 
 
 
 
 
 
285
  color: #ccc !important;
286
  }
287
 
 
 
 
 
 
288
  .qm .qm-sql {
289
  word-wrap: break-word !important;
290
  word-break: break-all !important;
335
  background: #eee !important;
336
  }
337
 
338
+ .qm .qm-warn {
 
339
  color: #f00 !important;
340
  }
341
 
410
  text-align: right !important;
411
  }
412
 
413
+ html[dir="rtl"] body:not(.iframe).sticky-menu #qm {
414
+ margin-right: 160px !important;
415
+ margin-left: 0 !important;
416
  }
417
 
418
+ @media all and (max-width: 900px) {
419
+ html[dir="rtl"] body:not(.iframe).sticky-menu #qm {
420
+ margin-right: 36px !important;
421
+ margin-left: 0 !important;
422
+ }
423
  }
424
 
425
+ html[dir="rtl"] body:not(.iframe).sticky-menu.folded #qm {
426
+ margin-right: 36px !important;
427
  margin-left: 0 !important;
428
  }
429
+
430
+ html[dir="rtl"] #qm {
431
+ text-align: right !important;
432
+ }
433
+
434
+ html[dir="rtl"] .qm td,
435
+ html[dir="rtl"] .qm th {
436
+ text-align: right !important;
437
+ }
collectors/environment.php CHANGED
@@ -96,7 +96,6 @@ class QM_Collector_Environment extends QM_Collector {
96
  'query_cache_size' => true, # Total cache size limit
97
  'query_cache_type' => 'ON' # Query cache on or off
98
  );
99
- $php_u = '';
100
 
101
  if ( $dbq = QueryMonitor::get_collector( 'db_queries' ) ) {
102
 
@@ -149,11 +148,16 @@ class QM_Collector_Environment extends QM_Collector {
149
 
150
  $this->data['php']['error_reporting'] = error_reporting();
151
 
152
- # @TODO put WP's other debugging constants in here, eg. SCRIPT_DEBUG
153
  $this->data['wp'] = array(
154
- 'version' => $wp_version,
155
- 'WP_DEBUG' => self::format_bool_constant( 'WP_DEBUG' ),
156
- 'WP_LOCAL_DEV' => self::format_bool_constant( 'WP_LOCAL_DEV' ),
 
 
 
 
 
 
157
  );
158
 
159
  if ( is_multisite() )
96
  'query_cache_size' => true, # Total cache size limit
97
  'query_cache_type' => 'ON' # Query cache on or off
98
  );
 
99
 
100
  if ( $dbq = QueryMonitor::get_collector( 'db_queries' ) ) {
101
 
148
 
149
  $this->data['php']['error_reporting'] = error_reporting();
150
 
 
151
  $this->data['wp'] = array(
152
+ 'version' => $wp_version,
153
+ 'WP_DEBUG' => self::format_bool_constant( 'WP_DEBUG' ),
154
+ 'WP_DEBUG_DISPLAY' => self::format_bool_constant( 'WP_DEBUG_DISPLAY' ),
155
+ 'WP_DEBUG_LOG' => self::format_bool_constant( 'WP_DEBUG_LOG' ),
156
+ 'SCRIPT_DEBUG' => self::format_bool_constant( 'SCRIPT_DEBUG' ),
157
+ 'CONCATENATE_SCRIPTS' => self::format_bool_constant( 'CONCATENATE_SCRIPTS' ),
158
+ 'COMPRESS_SCRIPTS' => self::format_bool_constant( 'COMPRESS_SCRIPTS' ),
159
+ 'COMPRESS_CSS' => self::format_bool_constant( 'COMPRESS_CSS' ),
160
+ 'WP_LOCAL_DEV' => self::format_bool_constant( 'WP_LOCAL_DEV' ),
161
  );
162
 
163
  if ( is_multisite() )
collectors/http.php CHANGED
@@ -99,9 +99,13 @@ class QM_Collector_HTTP extends QM_Collector {
99
  return $response;
100
  }
101
 
 
 
 
 
102
  // Something has filtered `pre_http_request` and short-circuited the request.
103
  $this->data['http'][$args['_qm_key']]['end'] = $this->data['http'][$args['_qm_original_key']]['start'];
104
- $this->data['http'][$args['_qm_key']]['response'] = new WP_Error( 'http_request_not_executed', __( 'Request not executed due to a filter on pre_http_request', 'query-monitor' ) );
105
 
106
  return $response;
107
  }
@@ -119,6 +123,11 @@ class QM_Collector_HTTP extends QM_Collector {
119
 
120
  public function process() {
121
 
 
 
 
 
 
122
  if ( ! isset( $this->data['http'] ) )
123
  return;
124
 
@@ -142,10 +151,6 @@ class QM_Collector_HTTP extends QM_Collector {
142
 
143
  }
144
 
145
- foreach ( array( 'WP_PROXY_HOST', 'WP_PROXY_PORT' ) as $var ) {
146
- if ( defined( $var ) and constant( $var ) )
147
- $this->data['vars'][$var] = constant( $var );
148
- }
149
 
150
  }
151
 
99
  return $response;
100
  }
101
 
102
+ if ( is_wp_error( $response ) ) {
103
+ return $response;
104
+ }
105
+
106
  // Something has filtered `pre_http_request` and short-circuited the request.
107
  $this->data['http'][$args['_qm_key']]['end'] = $this->data['http'][$args['_qm_original_key']]['start'];
108
+ $this->data['http'][$args['_qm_key']]['response'] = new WP_Error( 'http_request_not_executed', sprintf( __( 'Request not executed due to a filter on %s', 'query-monitor' ), 'pre_http_request' ) );
109
 
110
  return $response;
111
  }
123
 
124
  public function process() {
125
 
126
+ foreach ( array( 'WP_PROXY_HOST', 'WP_PROXY_PORT', 'WP_PROXY_USERNAME', 'WP_PROXY_PASSWORD', 'WP_PROXY_BYPASS_HOSTS' ) as $var ) {
127
+ if ( defined( $var ) and constant( $var ) )
128
+ $this->data['vars'][$var] = constant( $var );
129
+ }
130
+
131
  if ( ! isset( $this->data['http'] ) )
132
  return;
133
 
151
 
152
  }
153
 
 
 
 
 
154
 
155
  }
156
 
output/html/db_components.php CHANGED
@@ -61,7 +61,7 @@ class QM_Output_Html_DB_Components extends QM_Output_Html {
61
  $stime = number_format_i18n( $row['ltime'], 4 );
62
 
63
  echo '<tr>';
64
- echo "<td valign='top' class='qm-ltr'>{$row['component']}</td>";
65
 
66
  foreach ( $data['types'] as $type_name => $type_count ) {
67
  if ( isset( $row['types'][$type_name] ) )
61
  $stime = number_format_i18n( $row['ltime'], 4 );
62
 
63
  echo '<tr>';
64
+ echo "<td valign='top'>{$row['component']}</td>";
65
 
66
  foreach ( $data['types'] as $type_name => $type_count ) {
67
  if ( isset( $row['types'][$type_name] ) )
output/html/http.php CHANGED
@@ -43,6 +43,16 @@ class QM_Output_Html_HTTP extends QM_Output_Html {
43
  echo '</tr>';
44
  echo '</thead>';
45
 
 
 
 
 
 
 
 
 
 
 
46
  if ( !empty( $data['http'] ) ) {
47
 
48
  echo '<tbody>';
@@ -84,17 +94,7 @@ class QM_Output_Html_HTTP extends QM_Output_Html {
84
  else
85
  $transport = '';
86
 
87
- $stack = $row['trace']->get_stack();
88
-
89
- foreach ( $stack as & $frame ) {
90
- foreach ( array( 'WP_Http', 'wp_remote_', 'fetch_rss', 'fetch_feed', 'SimplePie', 'download_url' ) as $skip ) {
91
- if ( 0 === strpos( $frame, $skip ) ) {
92
- $frame = sprintf( '<span class="qm-na">%s</span>', $frame );
93
- break;
94
- }
95
- }
96
- }
97
-
98
  $component = $row['trace']->get_component();
99
 
100
  $stack = implode( '<br>', $stack );
@@ -116,16 +116,6 @@ class QM_Output_Html_HTTP extends QM_Output_Html {
116
 
117
  $total_stime = number_format_i18n( $total_time, 4 );
118
 
119
- $vars = '&nbsp;';
120
-
121
- if ( isset( $data['vars'] ) ) {
122
- $vars = array();
123
- foreach ( $data['vars'] as $key => $value ) {
124
- $vars[] = $key . ': ' . $value;
125
- }
126
- $vars = implode( ', ', $vars );
127
- }
128
-
129
  echo '<tr>';
130
  echo '<td colspan="6">' . $vars . '</td>';
131
  echo "<td>{$total_stime}</td>";
@@ -138,6 +128,11 @@ class QM_Output_Html_HTTP extends QM_Output_Html {
138
  echo '<tr>';
139
  echo '<td colspan="7" style="text-align:center !important"><em>' . __( 'none', 'query-monitor' ) . '</em></td>';
140
  echo '</tr>';
 
 
 
 
 
141
  echo '</tbody>';
142
 
143
  }
43
  echo '</tr>';
44
  echo '</thead>';
45
 
46
+ $vars = '';
47
+
48
+ if ( !empty( $data['vars'] ) ) {
49
+ $vars = array();
50
+ foreach ( $data['vars'] as $key => $value ) {
51
+ $vars[] = $key . ': ' . esc_html( $value );
52
+ }
53
+ $vars = implode( ', ', $vars );
54
+ }
55
+
56
  if ( !empty( $data['http'] ) ) {
57
 
58
  echo '<tbody>';
94
  else
95
  $transport = '';
96
 
97
+ $stack = $row['trace']->get_stack();
 
 
 
 
 
 
 
 
 
 
98
  $component = $row['trace']->get_component();
99
 
100
  $stack = implode( '<br>', $stack );
116
 
117
  $total_stime = number_format_i18n( $total_time, 4 );
118
 
 
 
 
 
 
 
 
 
 
 
119
  echo '<tr>';
120
  echo '<td colspan="6">' . $vars . '</td>';
121
  echo "<td>{$total_stime}</td>";
128
  echo '<tr>';
129
  echo '<td colspan="7" style="text-align:center !important"><em>' . __( 'none', 'query-monitor' ) . '</em></td>';
130
  echo '</tr>';
131
+ if ( !empty( $vars ) ) {
132
+ echo '<tr>';
133
+ echo '<td colspan="7">' . $vars . '</td>';
134
+ echo '</tr>';
135
+ }
136
  echo '</tbody>';
137
 
138
  }
output/html/transients.php CHANGED
@@ -55,15 +55,6 @@ class QM_Output_Html_Transients extends QM_Output_Html {
55
  $row['expiration'] = '<em>' . __( 'none', 'query-monitor' ) . '</em>';
56
  $expiration = ( isset( $row['expiration'] ) ) ? "<td valign='top'>{$row['expiration']}</td>\n" : '';
57
 
58
- foreach ( $stack as & $trace ) {
59
- foreach ( array( 'set_transient', 'set_site_transient' ) as $skip ) {
60
- if ( 0 === strpos( $trace, $skip ) ) {
61
- $trace = sprintf( '<span class="qm-na">%s</span>', $trace );
62
- break;
63
- }
64
- }
65
- }
66
-
67
  $component = $row['trace']->get_component();
68
 
69
  $stack = implode( '<br>', $stack );
55
  $row['expiration'] = '<em>' . __( 'none', 'query-monitor' ) . '</em>';
56
  $expiration = ( isset( $row['expiration'] ) ) ? "<td valign='top'>{$row['expiration']}</td>\n" : '';
57
 
 
 
 
 
 
 
 
 
 
58
  $component = $row['trace']->get_component();
59
 
60
  $stack = implode( '<br>', $stack );
query-monitor.php CHANGED
@@ -2,8 +2,8 @@
2
  /*
3
  Plugin Name: Query Monitor
4
  Description: Monitoring of database queries, hooks, conditionals and more.
5
- Version: 2.6.7
6
- Plugin URI: https://github.com/johnbillion/query-monitor
7
  Author: John Blackbourn
8
  Author URI: https://johnblackbourn.com/
9
  Text Domain: query-monitor
@@ -154,7 +154,7 @@ class QueryMonitor extends QM_Plugin {
154
 
155
  } else {
156
 
157
- if ( ! did_action( 'wp' ) ) {
158
  return false;
159
  }
160
 
2
  /*
3
  Plugin Name: Query Monitor
4
  Description: Monitoring of database queries, hooks, conditionals and more.
5
+ Version: 2.6.8
6
+ Plugin URI: https://querymonitor.com/
7
  Author: John Blackbourn
8
  Author URI: https://johnblackbourn.com/
9
  Text Domain: query-monitor
154
 
155
  } else {
156
 
157
+ if ( ! ( did_action( 'wp' ) or did_action( 'login_init' ) ) ) {
158
  return false;
159
  }
160
 
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: johnbillion
3
  Tags: debug, debugging, development, developer, performance, profiler, profiling, queries, query monitor
4
  Requires at least: 3.5
5
- Tested up to: 3.9
6
- Stable tag: 2.6.7
7
  License: GPLv2 or later
8
 
9
  View debugging and performance information on database queries, hooks, conditionals, HTTP requests, redirects and more.
@@ -12,7 +12,7 @@ View debugging and performance information on database queries, hooks, condition
12
 
13
  Query Monitor is a debugging plugin for anyone developing with WordPress. It has some advanced features not available in other debugging plugins, including automatic AJAX debugging and the ability to narrow down things by plugin or theme.
14
 
15
- For complete information, please see [Query Monitor's GitHub repo](https://github.com/johnbillion/QueryMonitor).
16
 
17
  Here's an overview of what's shown:
18
 
@@ -129,7 +129,7 @@ In addition to this, you can set an authentication cookie which allows you to vi
129
 
130
  Short answer: Yes, but only a little.
131
 
132
- Long answer: Query Monitor has a small impact on page generation time because it hooks into a few places in WordPress in the same way that other plugins do. The impact is negligable.
133
 
134
  On pages that have an especially high number of database queries (in the hundreds), Query Monitor currently uses more memory than I would like it to. This is due to the amount of data that is captured in the stack trace for each query. I have been and will be working to continually reduce this.
135
 
@@ -147,11 +147,17 @@ No, I do not accept donations. If you like the plugin, I'd love for you to [leav
147
 
148
  == Upgrade Notice ==
149
 
150
- = 2.6.7 =
151
- * Various tweaks under the hood. No shiny new features just yet.
152
 
153
  == Changelog ==
154
 
 
 
 
 
 
 
155
  = 2.6.7 =
156
  * Use an actual authentication cookie instead of a nonce in the Authentication component
157
  * Implement some extra methods of determining the current user/group
2
  Contributors: johnbillion
3
  Tags: debug, debugging, development, developer, performance, profiler, profiling, queries, query monitor
4
  Requires at least: 3.5
5
+ Tested up to: 4.1
6
+ Stable tag: 2.6.8
7
  License: GPLv2 or later
8
 
9
  View debugging and performance information on database queries, hooks, conditionals, HTTP requests, redirects and more.
12
 
13
  Query Monitor is a debugging plugin for anyone developing with WordPress. It has some advanced features not available in other debugging plugins, including automatic AJAX debugging and the ability to narrow down things by plugin or theme.
14
 
15
+ For complete information, please see [the Query Monitor home page](https://querymonitor.com/) or [Query Monitor's GitHub repo](https://github.com/johnbillion/QueryMonitor).
16
 
17
  Here's an overview of what's shown:
18
 
129
 
130
  Short answer: Yes, but only a little.
131
 
132
+ Long answer: Query Monitor has a small impact on page generation time because it hooks into a few places in WordPress in the same way that other plugins do. The impact is negligible.
133
 
134
  On pages that have an especially high number of database queries (in the hundreds), Query Monitor currently uses more memory than I would like it to. This is due to the amount of data that is captured in the stack trace for each query. I have been and will be working to continually reduce this.
135
 
147
 
148
  == Upgrade Notice ==
149
 
150
+ = 2.6.8 =
151
+ * Misc minor bugfixes. Nothing to get excited about.
152
 
153
  == Changelog ==
154
 
155
+ = 2.6.8 =
156
+ * RTL layout tweaks
157
+ * Correct the component detection logic so it's more accurate
158
+ * Re-implement output on the login screen which went missing
159
+ * Display a few more proxy and debugging related constants
160
+
161
  = 2.6.7 =
162
  * Use an actual authentication cookie instead of a nonce in the Authentication component
163
  * Implement some extra methods of determining the current user/group
wp-content/db.php CHANGED
@@ -83,7 +83,9 @@ class QueryMonitorDB extends wpdb {
83
  return $result;
84
 
85
  $i = $this->num_queries - 1;
86
- $this->queries[$i]['trace'] = new QM_Backtrace;
 
 
87
 
88
  if ( $this->last_error )
89
  $this->queries[$i]['result'] = new WP_Error( 'qmdb', $this->last_error );
83
  return $result;
84
 
85
  $i = $this->num_queries - 1;
86
+ $this->queries[$i]['trace'] = new QM_Backtrace( array(
87
+ 'ignore_items' => 1,
88
+ ) );
89
 
90
  if ( $this->last_error )
91
  $this->queries[$i]['result'] = new WP_Error( 'qmdb', $this->last_error );