Version Description
Download this release
Release Info
Developer | johnbillion |
Plugin | Query Monitor |
Version | 3.6.5 |
Comparing to | |
See all releases |
Code changes from version 3.6.4 to 3.6.5
- assets/query-monitor.js +44 -24
- classes/Activation.php +1 -2
- classes/Backtrace.php +27 -27
- classes/Hook.php +1 -1
- classes/Util.php +11 -0
- collectors/environment.php +7 -6
- dispatchers/Html.php +19 -11
- output/html/logger.php +32 -28
- query-monitor.php +11 -2
- readme.txt +24 -16
assets/query-monitor.js
CHANGED
@@ -164,7 +164,7 @@ if ( window.jQuery ) {
|
|
164 |
var filters = $( panel ).find('.qm-filter');
|
165 |
|
166 |
if ( filters.length ) {
|
167 |
-
filters.change
|
168 |
} else {
|
169 |
stripes( $(panel).find('table') );
|
170 |
}
|
@@ -278,7 +278,7 @@ if ( window.jQuery ) {
|
|
278 |
if ( ! $(this).find('option[value="' + val + '"]').length ) {
|
279 |
$('<option>').attr('value',value).text(value).appendTo(this);
|
280 |
}
|
281 |
-
$(this).val(value).change
|
282 |
}
|
283 |
});
|
284 |
|
@@ -286,8 +286,8 @@ if ( window.jQuery ) {
|
|
286 |
var filter = $(this).data('qm-filter'),
|
287 |
value = $(this).data('qm-value'),
|
288 |
target = $(this).data('qm-target');
|
289 |
-
$('#qm-' + target).find('.qm-filter').not('[data-filter="' + filter + '"]').val('').removeClass('qm-highlight').change
|
290 |
-
$('#qm-' + target).find('[data-filter="' + filter + '"]').val(value).addClass('qm-highlight').change
|
291 |
show_panel( '#qm-' + target );
|
292 |
$('#qm-' + target).focus();
|
293 |
e.preventDefault();
|
@@ -368,7 +368,7 @@ if ( window.jQuery ) {
|
|
368 |
|
369 |
for ( var key = 1; key <= errors; key++ ) {
|
370 |
|
371 |
-
error =
|
372 |
|
373 |
if ( window.console ) {
|
374 |
switch ( error.type ) {
|
@@ -465,32 +465,40 @@ if ( window.jQuery ) {
|
|
465 |
var startY, startX, resizerHeight;
|
466 |
|
467 |
$(document).on('mousedown touchstart', '.qm-resizer', function(event) {
|
|
|
|
|
468 |
resizerHeight = $(this).outerHeight() - 1;
|
469 |
startY = container.outerHeight() + ( event.clientY || event.originalEvent.targetTouches[0].pageY );
|
470 |
startX = container.outerWidth() + ( event.clientX || event.originalEvent.targetTouches[0].pageX );
|
471 |
|
472 |
-
|
|
|
|
|
|
|
|
|
|
|
473 |
$(document).on('mouseup touchend', qm_stop_resizer_drag);
|
474 |
});
|
475 |
|
476 |
-
function
|
477 |
-
if ( ! container.hasClass('qm-show-right') ) {
|
478 |
var h = ( startY - ( event.clientY || event.originalEvent.targetTouches[0].pageY ) );
|
479 |
if ( h >= resizerHeight && h <= maxheight ) {
|
480 |
container.height( h );
|
481 |
body.css( 'margin-bottom', 'calc( ' + body_margin + ' + ' + h + 'px )' );
|
482 |
}
|
483 |
-
|
|
|
|
|
484 |
var w = ( startX - event.clientX );
|
485 |
if ( w >= minwidth && w <= maxwidth ) {
|
486 |
container.width( w );
|
487 |
}
|
488 |
body.css( 'margin-bottom', '' );
|
489 |
-
}
|
490 |
}
|
491 |
|
492 |
function qm_stop_resizer_drag(event) {
|
493 |
-
$(document).off('mousemove touchmove',
|
|
|
494 |
$(document).off('mouseup touchend', qm_stop_resizer_drag);
|
495 |
|
496 |
if ( ! container.hasClass('qm-show-right') ) {
|
@@ -553,18 +561,18 @@ if ( window.jQuery ) {
|
|
553 |
}
|
554 |
});
|
555 |
|
556 |
-
$('.qm-button-container-close').click
|
557 |
container.removeClass('qm-show').height('').width('');
|
558 |
body.css( 'margin-bottom', '' );
|
559 |
localStorage.removeItem( container_pinned_key );
|
560 |
});
|
561 |
|
562 |
-
$('.qm-button-container-settings,a[href="#qm-settings"]').click
|
563 |
show_panel( '#qm-settings' );
|
564 |
$('#qm-settings').focus();
|
565 |
});
|
566 |
|
567 |
-
$('.qm-button-container-position').click
|
568 |
container.toggleClass('qm-show-right');
|
569 |
|
570 |
if ( container.hasClass('qm-show-right') ) {
|
@@ -589,7 +597,7 @@ if ( window.jQuery ) {
|
|
589 |
show_panel( pinned );
|
590 |
}
|
591 |
|
592 |
-
$('.qm-title-heading select').change
|
593 |
show_panel( $(this).val() );
|
594 |
$($(this).val()).focus();
|
595 |
});
|
@@ -713,24 +721,36 @@ if ( window.jQuery ) {
|
|
713 |
}
|
714 |
|
715 |
window.addEventListener('load', function() {
|
|
|
|
|
|
|
|
|
716 |
if ( ( 'undefined' === typeof jQuery ) || ! window.jQuery ) {
|
717 |
-
/* Fallback for running without jQuery (`QM_NO_JQUERY`) */
|
718 |
-
document.getElementById( 'query-monitor-main' ).className += ' qm-broken';
|
719 |
-
console.error( document.getElementById( 'qm-broken' ).textContent );
|
720 |
|
721 |
-
if (
|
722 |
-
|
|
|
|
|
|
|
|
|
723 |
}
|
724 |
|
725 |
-
if (
|
|
|
|
|
726 |
console.error( 'QM error from JS: no jQuery' );
|
727 |
}
|
728 |
|
729 |
-
|
730 |
-
if ( menu_item ) {
|
731 |
menu_item.addEventListener( 'click', function() {
|
732 |
-
|
733 |
} );
|
734 |
}
|
735 |
}
|
|
|
|
|
|
|
|
|
|
|
736 |
} );
|
164 |
var filters = $( panel ).find('.qm-filter');
|
165 |
|
166 |
if ( filters.length ) {
|
167 |
+
filters.trigger('change');
|
168 |
} else {
|
169 |
stripes( $(panel).find('table') );
|
170 |
}
|
278 |
if ( ! $(this).find('option[value="' + val + '"]').length ) {
|
279 |
$('<option>').attr('value',value).text(value).appendTo(this);
|
280 |
}
|
281 |
+
$(this).val(value).trigger('change');
|
282 |
}
|
283 |
});
|
284 |
|
286 |
var filter = $(this).data('qm-filter'),
|
287 |
value = $(this).data('qm-value'),
|
288 |
target = $(this).data('qm-target');
|
289 |
+
$('#qm-' + target).find('.qm-filter').not('[data-filter="' + filter + '"]').val('').removeClass('qm-highlight').trigger('change');
|
290 |
+
$('#qm-' + target).find('[data-filter="' + filter + '"]').val(value).addClass('qm-highlight').trigger('change');
|
291 |
show_panel( '#qm-' + target );
|
292 |
$('#qm-' + target).focus();
|
293 |
e.preventDefault();
|
368 |
|
369 |
for ( var key = 1; key <= errors; key++ ) {
|
370 |
|
371 |
+
error = JSON.parse( response.getResponseHeader( 'X-QM-php_errors-error-' + key ) );
|
372 |
|
373 |
if ( window.console ) {
|
374 |
switch ( error.type ) {
|
465 |
var startY, startX, resizerHeight;
|
466 |
|
467 |
$(document).on('mousedown touchstart', '.qm-resizer', function(event) {
|
468 |
+
event.stopPropagation();
|
469 |
+
|
470 |
resizerHeight = $(this).outerHeight() - 1;
|
471 |
startY = container.outerHeight() + ( event.clientY || event.originalEvent.targetTouches[0].pageY );
|
472 |
startX = container.outerWidth() + ( event.clientX || event.originalEvent.targetTouches[0].pageX );
|
473 |
|
474 |
+
if ( ! container.hasClass('qm-show-right') ) {
|
475 |
+
$(document).on('mousemove touchmove', qm_do_resizer_drag_vertical);
|
476 |
+
} else {
|
477 |
+
$(document).on('mousemove touchmove', qm_do_resizer_drag_horizontal);
|
478 |
+
}
|
479 |
+
|
480 |
$(document).on('mouseup touchend', qm_stop_resizer_drag);
|
481 |
});
|
482 |
|
483 |
+
function qm_do_resizer_drag_vertical(event) {
|
|
|
484 |
var h = ( startY - ( event.clientY || event.originalEvent.targetTouches[0].pageY ) );
|
485 |
if ( h >= resizerHeight && h <= maxheight ) {
|
486 |
container.height( h );
|
487 |
body.css( 'margin-bottom', 'calc( ' + body_margin + ' + ' + h + 'px )' );
|
488 |
}
|
489 |
+
}
|
490 |
+
|
491 |
+
function qm_do_resizer_drag_horizontal(event) {
|
492 |
var w = ( startX - event.clientX );
|
493 |
if ( w >= minwidth && w <= maxwidth ) {
|
494 |
container.width( w );
|
495 |
}
|
496 |
body.css( 'margin-bottom', '' );
|
|
|
497 |
}
|
498 |
|
499 |
function qm_stop_resizer_drag(event) {
|
500 |
+
$(document).off('mousemove touchmove', qm_do_resizer_drag_vertical);
|
501 |
+
$(document).off('mousemove touchmove', qm_do_resizer_drag_horizontal);
|
502 |
$(document).off('mouseup touchend', qm_stop_resizer_drag);
|
503 |
|
504 |
if ( ! container.hasClass('qm-show-right') ) {
|
561 |
}
|
562 |
});
|
563 |
|
564 |
+
$('.qm-button-container-close').on('click',function(){
|
565 |
container.removeClass('qm-show').height('').width('');
|
566 |
body.css( 'margin-bottom', '' );
|
567 |
localStorage.removeItem( container_pinned_key );
|
568 |
});
|
569 |
|
570 |
+
$('.qm-button-container-settings,a[href="#qm-settings"]').on('click',function(){
|
571 |
show_panel( '#qm-settings' );
|
572 |
$('#qm-settings').focus();
|
573 |
});
|
574 |
|
575 |
+
$('.qm-button-container-position').on('click',function(){
|
576 |
container.toggleClass('qm-show-right');
|
577 |
|
578 |
if ( container.hasClass('qm-show-right') ) {
|
597 |
show_panel( pinned );
|
598 |
}
|
599 |
|
600 |
+
$('.qm-title-heading select').on('change',function(){
|
601 |
show_panel( $(this).val() );
|
602 |
$($(this).val()).focus();
|
603 |
});
|
721 |
}
|
722 |
|
723 |
window.addEventListener('load', function() {
|
724 |
+
var main = document.getElementById( 'query-monitor-main' );
|
725 |
+
var broken = document.getElementById( 'qm-broken' );
|
726 |
+
var menu_item = document.getElementById( 'wp-admin-bar-query-monitor' );
|
727 |
+
|
728 |
if ( ( 'undefined' === typeof jQuery ) || ! window.jQuery ) {
|
729 |
+
/* Fallback for running without jQuery (`QM_NO_JQUERY`) or when jQuery is broken */
|
|
|
|
|
730 |
|
731 |
+
if ( main ) {
|
732 |
+
main.className += ' qm-broken';
|
733 |
+
}
|
734 |
+
|
735 |
+
if ( broken ) {
|
736 |
+
console.error( broken.textContent );
|
737 |
}
|
738 |
|
739 |
+
if ( 'undefined' === typeof jQuery ) {
|
740 |
+
console.error( 'QM error from JS: undefined jQuery' );
|
741 |
+
} else if ( ! window.jQuery ) {
|
742 |
console.error( 'QM error from JS: no jQuery' );
|
743 |
}
|
744 |
|
745 |
+
if ( menu_item && main ) {
|
|
|
746 |
menu_item.addEventListener( 'click', function() {
|
747 |
+
main.className += ' qm-show';
|
748 |
} );
|
749 |
}
|
750 |
}
|
751 |
+
|
752 |
+
if ( ! main ) {
|
753 |
+
// QM's output has disappeared
|
754 |
+
console.error( 'QM error from JS: QM output does not exist' );
|
755 |
+
}
|
756 |
} );
|
classes/Activation.php
CHANGED
@@ -99,9 +99,8 @@ class QM_Activation extends QM_Plugin {
|
|
99 |
|
100 |
public function php_notice() {
|
101 |
?>
|
102 |
-
<div id="qm_php_notice" class="error">
|
103 |
<p>
|
104 |
-
<span class="dashicons dashicons-warning" style="color:#dd3232" aria-hidden="true"></span>
|
105 |
<?php
|
106 |
echo esc_html( sprintf(
|
107 |
/* Translators: 1: Minimum required PHP version, 2: Current PHP version. */
|
99 |
|
100 |
public function php_notice() {
|
101 |
?>
|
102 |
+
<div id="qm_php_notice" class="notice notice-error">
|
103 |
<p>
|
|
|
104 |
<?php
|
105 |
echo esc_html( sprintf(
|
106 |
/* Translators: 1: Minimum required PHP version, 2: Current PHP version. */
|
classes/Backtrace.php
CHANGED
@@ -227,7 +227,7 @@ class QM_Backtrace {
|
|
227 |
|
228 |
}
|
229 |
|
230 |
-
public function filter_trace( array $
|
231 |
|
232 |
if ( ! self::$filtered && function_exists( 'did_action' ) && did_action( 'plugins_loaded' ) ) {
|
233 |
|
@@ -277,48 +277,48 @@ class QM_Backtrace {
|
|
277 |
|
278 |
}
|
279 |
|
280 |
-
$return = $
|
281 |
|
282 |
-
if ( isset( $
|
283 |
-
if ( isset( self::$ignore_class[ $
|
284 |
$return = null;
|
285 |
-
} elseif ( isset( self::$ignore_method[ $
|
286 |
$return = null;
|
287 |
-
} elseif ( 0 === strpos( $
|
288 |
$return = null;
|
289 |
} else {
|
290 |
-
$return['id'] = $
|
291 |
-
$return['display'] = QM_Util::shorten_fqn( $
|
292 |
}
|
293 |
} else {
|
294 |
-
if ( isset( self::$ignore_func[ $
|
295 |
$return = null;
|
296 |
-
} elseif ( isset( self::$show_args[ $
|
297 |
-
$show = self::$show_args[ $
|
298 |
|
299 |
if ( 'dir' === $show ) {
|
300 |
-
if ( isset( $
|
301 |
-
$arg = QM_Util::standard_dir( $
|
302 |
-
$return['id'] = $
|
303 |
-
$return['display'] = QM_Util::shorten_fqn( $
|
304 |
}
|
305 |
} else {
|
306 |
$args = array();
|
307 |
for ( $i = 0; $i < $show; $i++ ) {
|
308 |
-
if ( isset( $
|
309 |
-
if ( is_string( $
|
310 |
-
$args[] = '\'' . $
|
311 |
} else {
|
312 |
-
$args[] = QM_Util::display_variable( $
|
313 |
}
|
314 |
}
|
315 |
}
|
316 |
-
$return['id'] = $
|
317 |
-
$return['display'] = QM_Util::shorten_fqn( $
|
318 |
}
|
319 |
} else {
|
320 |
-
$return['id'] = $
|
321 |
-
$return['display'] = QM_Util::shorten_fqn( $
|
322 |
}
|
323 |
}
|
324 |
|
@@ -329,11 +329,11 @@ class QM_Backtrace {
|
|
329 |
|
330 |
}
|
331 |
|
332 |
-
if ( isset( $
|
333 |
-
$this->calling_line = $
|
334 |
}
|
335 |
-
if ( isset( $
|
336 |
-
$this->calling_file = $
|
337 |
}
|
338 |
|
339 |
return $return;
|
227 |
|
228 |
}
|
229 |
|
230 |
+
public function filter_trace( array $frame ) {
|
231 |
|
232 |
if ( ! self::$filtered && function_exists( 'did_action' ) && did_action( 'plugins_loaded' ) ) {
|
233 |
|
277 |
|
278 |
}
|
279 |
|
280 |
+
$return = $frame;
|
281 |
|
282 |
+
if ( isset( $frame['class'] ) ) {
|
283 |
+
if ( isset( self::$ignore_class[ $frame['class'] ] ) ) {
|
284 |
$return = null;
|
285 |
+
} elseif ( isset( self::$ignore_method[ $frame['class'] ][ $frame['function'] ] ) ) {
|
286 |
$return = null;
|
287 |
+
} elseif ( 0 === strpos( $frame['class'], 'QM' ) ) {
|
288 |
$return = null;
|
289 |
} else {
|
290 |
+
$return['id'] = $frame['class'] . $frame['type'] . $frame['function'] . '()';
|
291 |
+
$return['display'] = QM_Util::shorten_fqn( $frame['class'] . $frame['type'] . $frame['function'] ) . '()';
|
292 |
}
|
293 |
} else {
|
294 |
+
if ( isset( self::$ignore_func[ $frame['function'] ] ) ) {
|
295 |
$return = null;
|
296 |
+
} elseif ( isset( self::$show_args[ $frame['function'] ] ) ) {
|
297 |
+
$show = self::$show_args[ $frame['function'] ];
|
298 |
|
299 |
if ( 'dir' === $show ) {
|
300 |
+
if ( isset( $frame['args'][0] ) ) {
|
301 |
+
$arg = QM_Util::standard_dir( $frame['args'][0], '' );
|
302 |
+
$return['id'] = $frame['function'] . '()';
|
303 |
+
$return['display'] = QM_Util::shorten_fqn( $frame['function'] ) . "('{$arg}')";
|
304 |
}
|
305 |
} else {
|
306 |
$args = array();
|
307 |
for ( $i = 0; $i < $show; $i++ ) {
|
308 |
+
if ( isset( $frame['args'][ $i ] ) ) {
|
309 |
+
if ( is_string( $frame['args'][ $i ] ) ) {
|
310 |
+
$args[] = '\'' . $frame['args'][ $i ] . '\'';
|
311 |
} else {
|
312 |
+
$args[] = QM_Util::display_variable( $frame['args'][ $i ] );
|
313 |
}
|
314 |
}
|
315 |
}
|
316 |
+
$return['id'] = $frame['function'] . '()';
|
317 |
+
$return['display'] = QM_Util::shorten_fqn( $frame['function'] ) . '(' . implode( ',', $args ) . ')';
|
318 |
}
|
319 |
} else {
|
320 |
+
$return['id'] = $frame['function'] . '()';
|
321 |
+
$return['display'] = QM_Util::shorten_fqn( $frame['function'] ) . '()';
|
322 |
}
|
323 |
}
|
324 |
|
329 |
|
330 |
}
|
331 |
|
332 |
+
if ( isset( $frame['line'] ) ) {
|
333 |
+
$this->calling_line = $frame['line'];
|
334 |
}
|
335 |
+
if ( isset( $frame['file'] ) ) {
|
336 |
+
$this->calling_file = $frame['file'];
|
337 |
}
|
338 |
|
339 |
return $return;
|
classes/Hook.php
CHANGED
@@ -46,7 +46,7 @@ class QM_Hook {
|
|
46 |
}
|
47 |
}
|
48 |
|
49 |
-
$parts = array_values( array_filter( preg_split( '#[_
|
50 |
|
51 |
return array(
|
52 |
'name' => $name,
|
46 |
}
|
47 |
}
|
48 |
|
49 |
+
$parts = array_values( array_filter( preg_split( '#[_/.-]#', $name ) ) );
|
50 |
|
51 |
return array(
|
52 |
'name' => $name,
|
classes/Util.php
CHANGED
@@ -94,6 +94,10 @@ class QM_Util {
|
|
94 |
self::$file_dirs['vip-client-mu-plugin'] = WPCOM_VIP_CLIENT_MU_PLUGIN_DIR;
|
95 |
}
|
96 |
|
|
|
|
|
|
|
|
|
97 |
self::$file_dirs['theme'] = null;
|
98 |
self::$file_dirs['stylesheet'] = get_stylesheet_directory();
|
99 |
self::$file_dirs['template'] = get_template_directory();
|
@@ -129,6 +133,13 @@ class QM_Util {
|
|
129 |
$context = $type;
|
130 |
|
131 |
switch ( $type ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
case 'plugin':
|
133 |
case 'mu-plugin':
|
134 |
case 'mu-vendor':
|
94 |
self::$file_dirs['vip-client-mu-plugin'] = WPCOM_VIP_CLIENT_MU_PLUGIN_DIR;
|
95 |
}
|
96 |
|
97 |
+
if ( defined( '\Altis\ROOT_DIR' ) ) {
|
98 |
+
self::$file_dirs['altis-vendor'] = \Altis\ROOT_DIR . '/vendor';
|
99 |
+
}
|
100 |
+
|
101 |
self::$file_dirs['theme'] = null;
|
102 |
self::$file_dirs['stylesheet'] = get_stylesheet_directory();
|
103 |
self::$file_dirs['template'] = get_template_directory();
|
133 |
$context = $type;
|
134 |
|
135 |
switch ( $type ) {
|
136 |
+
case 'altis-vendor':
|
137 |
+
$plug = str_replace( \Altis\ROOT_DIR . '/vendor/', '', $file );
|
138 |
+
$plug = explode( '/', $plug, 3 );
|
139 |
+
$plug = $plug[0] . '/' . $plug[1];
|
140 |
+
/* translators: %s: Dependency name */
|
141 |
+
$name = sprintf( __( 'Dependency: %s', 'query-monitor' ), $plug );
|
142 |
+
break;
|
143 |
case 'plugin':
|
144 |
case 'mu-plugin':
|
145 |
case 'mu-vendor':
|
collectors/environment.php
CHANGED
@@ -74,12 +74,13 @@ class QM_Collector_Environment extends QM_Collector {
|
|
74 |
global $wp_version;
|
75 |
|
76 |
$mysql_vars = array(
|
77 |
-
'key_buffer_size'
|
78 |
-
'max_allowed_packet'
|
79 |
-
'max_connections'
|
80 |
-
'query_cache_limit'
|
81 |
-
'query_cache_size'
|
82 |
-
'query_cache_type'
|
|
|
83 |
);
|
84 |
|
85 |
$dbq = QM_Collectors::get( 'db_queries' );
|
74 |
global $wp_version;
|
75 |
|
76 |
$mysql_vars = array(
|
77 |
+
'key_buffer_size' => true, # Key cache size limit
|
78 |
+
'max_allowed_packet' => false, # Individual query size limit
|
79 |
+
'max_connections' => false, # Max number of client connections
|
80 |
+
'query_cache_limit' => true, # Individual query cache size limit
|
81 |
+
'query_cache_size' => true, # Total cache size limit
|
82 |
+
'query_cache_type' => 'ON', # Query cache on or off
|
83 |
+
'innodb_buffer_pool_size' => false, # The amount of memory allocated to the InnoDB buffer pool
|
84 |
);
|
85 |
|
86 |
$dbq = QM_Collectors::get( 'db_queries' );
|
dispatchers/Html.php
CHANGED
@@ -584,31 +584,39 @@ class QM_Dispatcher_Html extends QM_Dispatcher {
|
|
584 |
echo '<script type="text/javascript">' . "\n\n";
|
585 |
?>
|
586 |
window.addEventListener('load', function() {
|
587 |
-
|
|
|
|
|
|
|
|
|
|
|
588 |
/* Fallback for worst case scenario */
|
589 |
-
document.getElementById( 'query-monitor-main' ).className += ' qm-broken';
|
590 |
-
console.error( document.getElementById( 'qm-broken' ).textContent );
|
591 |
|
592 |
if ( 'undefined' === typeof QM_i18n ) {
|
593 |
console.error( 'QM error from page: undefined QM_i18n' );
|
594 |
}
|
595 |
|
596 |
-
if (
|
597 |
-
|
598 |
}
|
599 |
|
600 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
601 |
console.error( 'QM error from page: no jQuery' );
|
602 |
}
|
603 |
|
604 |
-
|
605 |
-
if ( menu_item ) {
|
606 |
menu_item.addEventListener( 'click', function() {
|
607 |
-
|
608 |
} );
|
609 |
}
|
610 |
-
} else if (
|
611 |
-
|
612 |
}
|
613 |
} );
|
614 |
<?php
|
584 |
echo '<script type="text/javascript">' . "\n\n";
|
585 |
?>
|
586 |
window.addEventListener('load', function() {
|
587 |
+
var main = document.getElementById( 'query-monitor-main' );
|
588 |
+
var broken = document.getElementById( 'qm-broken' );
|
589 |
+
var menu_item = document.getElementById( 'wp-admin-bar-query-monitor' );
|
590 |
+
var admin_bar = document.getElementById( 'wpadminbar' );
|
591 |
+
|
592 |
+
if ( ( 'undefined' === typeof QM_i18n ) && ( ( 'undefined' === typeof jQuery ) || ! window.jQuery ) ) {
|
593 |
/* Fallback for worst case scenario */
|
|
|
|
|
594 |
|
595 |
if ( 'undefined' === typeof QM_i18n ) {
|
596 |
console.error( 'QM error from page: undefined QM_i18n' );
|
597 |
}
|
598 |
|
599 |
+
if ( main ) {
|
600 |
+
main.className += ' qm-broken';
|
601 |
}
|
602 |
|
603 |
+
if ( broken ) {
|
604 |
+
console.error( broken.textContent );
|
605 |
+
}
|
606 |
+
|
607 |
+
if ( 'undefined' === typeof jQuery ) {
|
608 |
+
console.error( 'QM error from page: undefined jQuery' );
|
609 |
+
} else if ( ! window.jQuery ) {
|
610 |
console.error( 'QM error from page: no jQuery' );
|
611 |
}
|
612 |
|
613 |
+
if ( menu_item && main ) {
|
|
|
614 |
menu_item.addEventListener( 'click', function() {
|
615 |
+
main.className += ' qm-show';
|
616 |
} );
|
617 |
}
|
618 |
+
} else if ( main && ! admin_bar ) {
|
619 |
+
main.className += ' qm-peek';
|
620 |
}
|
621 |
} );
|
622 |
<?php
|
output/html/logger.php
CHANGED
@@ -16,7 +16,7 @@ class QM_Output_Html_Logger extends QM_Output_Html {
|
|
16 |
|
17 |
public function __construct( QM_Collector $collector ) {
|
18 |
parent::__construct( $collector );
|
19 |
-
add_filter( 'qm/output/menus', array( $this, 'admin_menu' ),
|
20 |
add_filter( 'qm/output/menu_class', array( $this, 'admin_class' ) );
|
21 |
}
|
22 |
|
@@ -29,6 +29,17 @@ class QM_Output_Html_Logger extends QM_Output_Html {
|
|
29 |
$data = $this->collector->get_data();
|
30 |
|
31 |
if ( empty( $data['logs'] ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
return;
|
33 |
}
|
34 |
|
@@ -85,17 +96,10 @@ class QM_Output_Html_Logger extends QM_Output_Html {
|
|
85 |
echo esc_html( ucfirst( $row['level'] ) );
|
86 |
echo '</td>';
|
87 |
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
);
|
93 |
-
} else {
|
94 |
-
printf(
|
95 |
-
'<td>%s</td>',
|
96 |
-
esc_html( $row['message'] )
|
97 |
-
);
|
98 |
-
}
|
99 |
|
100 |
$stack = array();
|
101 |
$filtered_trace = $row['trace']->get_display_trace();
|
@@ -154,25 +158,25 @@ class QM_Output_Html_Logger extends QM_Output_Html {
|
|
154 |
}
|
155 |
|
156 |
public function admin_menu( array $menu ) {
|
157 |
-
$data
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
$key = 'warning';
|
168 |
-
break;
|
169 |
}
|
170 |
-
}
|
171 |
|
172 |
-
|
173 |
|
174 |
-
|
175 |
-
|
|
|
|
|
|
|
176 |
|
177 |
$menu[ $this->collector->id() ] = $this->menu( array(
|
178 |
'id' => "query-monitor-logger-{$key}",
|
16 |
|
17 |
public function __construct( QM_Collector $collector ) {
|
18 |
parent::__construct( $collector );
|
19 |
+
add_filter( 'qm/output/menus', array( $this, 'admin_menu' ), 46 );
|
20 |
add_filter( 'qm/output/menu_class', array( $this, 'admin_class' ) );
|
21 |
}
|
22 |
|
29 |
$data = $this->collector->get_data();
|
30 |
|
31 |
if ( empty( $data['logs'] ) ) {
|
32 |
+
$this->before_non_tabular_output();
|
33 |
+
|
34 |
+
$notice = sprintf(
|
35 |
+
/* translators: %s: Link to help article */
|
36 |
+
__( 'No data logged. <a href="%s">Read about logging variables in Query Monitor</a>.', 'query-monitor' ),
|
37 |
+
'https://querymonitor.com/docs/logging-variables/'
|
38 |
+
);
|
39 |
+
echo $this->build_notice( $notice ); // WPCS: XSS ok.
|
40 |
+
|
41 |
+
$this->after_non_tabular_output();
|
42 |
+
|
43 |
return;
|
44 |
}
|
45 |
|
96 |
echo esc_html( ucfirst( $row['level'] ) );
|
97 |
echo '</td>';
|
98 |
|
99 |
+
printf(
|
100 |
+
'<td><pre>%s</pre></td>',
|
101 |
+
esc_html( $row['message'] )
|
102 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
|
104 |
$stack = array();
|
105 |
$filtered_trace = $row['trace']->get_display_trace();
|
158 |
}
|
159 |
|
160 |
public function admin_menu( array $menu ) {
|
161 |
+
$data = $this->collector->get_data();
|
162 |
+
$key = 'log';
|
163 |
+
$count = 0;
|
164 |
+
|
165 |
+
if ( ! empty( $data['logs'] ) ) {
|
166 |
+
foreach ( $data['logs'] as $log ) {
|
167 |
+
if ( in_array( $log['level'], $this->collector->get_warning_levels(), true ) ) {
|
168 |
+
$key = 'warning';
|
169 |
+
break;
|
170 |
+
}
|
|
|
|
|
171 |
}
|
|
|
172 |
|
173 |
+
$count = count( $data['logs'] );
|
174 |
|
175 |
+
/* translators: %s: Number of logs that are available */
|
176 |
+
$label = __( 'Logs (%s)', 'query-monitor' );
|
177 |
+
} else {
|
178 |
+
$label = __( 'Logs', 'query-monitor' );
|
179 |
+
}
|
180 |
|
181 |
$menu[ $this->collector->id() ] = $this->menu( array(
|
182 |
'id' => "query-monitor-logger-{$key}",
|
query-monitor.php
CHANGED
@@ -5,12 +5,12 @@
|
|
5 |
* @package query-monitor
|
6 |
* @link https://github.com/johnbillion/query-monitor
|
7 |
* @author John Blackbourn <john@johnblackbourn.com>
|
8 |
-
* @copyright 2009-
|
9 |
* @license GPL v2 or later
|
10 |
*
|
11 |
* Plugin Name: Query Monitor
|
12 |
* Description: The Developer Tools Panel for WordPress.
|
13 |
-
* Version: 3.6.
|
14 |
* Plugin URI: https://querymonitor.com/
|
15 |
* Author: John Blackbourn
|
16 |
* Author URI: https://querymonitor.com/
|
@@ -47,6 +47,10 @@ foreach ( array( 'Activation', 'Util', 'QM' ) as $qm_class ) {
|
|
47 |
|
48 |
QM_Activation::init( __FILE__ );
|
49 |
|
|
|
|
|
|
|
|
|
50 |
if ( defined( 'WP_CLI' ) && WP_CLI ) {
|
51 |
require_once "{$qm_dir}/classes/CLI.php";
|
52 |
QM_CLI::init( __FILE__ );
|
@@ -71,4 +75,9 @@ foreach ( array( 'QueryMonitor', 'Backtrace', 'Collectors', 'Collector', 'Dispat
|
|
71 |
require_once "{$qm_dir}/classes/{$qm_class}.php";
|
72 |
}
|
73 |
|
|
|
|
|
|
|
|
|
|
|
74 |
QueryMonitor::init( __FILE__ );
|
5 |
* @package query-monitor
|
6 |
* @link https://github.com/johnbillion/query-monitor
|
7 |
* @author John Blackbourn <john@johnblackbourn.com>
|
8 |
+
* @copyright 2009-2020 John Blackbourn
|
9 |
* @license GPL v2 or later
|
10 |
*
|
11 |
* Plugin Name: Query Monitor
|
12 |
* Description: The Developer Tools Panel for WordPress.
|
13 |
+
* Version: 3.6.5
|
14 |
* Plugin URI: https://querymonitor.com/
|
15 |
* Author: John Blackbourn
|
16 |
* Author URI: https://querymonitor.com/
|
47 |
|
48 |
QM_Activation::init( __FILE__ );
|
49 |
|
50 |
+
if ( ! QM_Plugin::php_version_met() ) {
|
51 |
+
return;
|
52 |
+
}
|
53 |
+
|
54 |
if ( defined( 'WP_CLI' ) && WP_CLI ) {
|
55 |
require_once "{$qm_dir}/classes/CLI.php";
|
56 |
QM_CLI::init( __FILE__ );
|
75 |
require_once "{$qm_dir}/classes/{$qm_class}.php";
|
76 |
}
|
77 |
|
78 |
+
unset(
|
79 |
+
$qm_dir,
|
80 |
+
$qm_class
|
81 |
+
);
|
82 |
+
|
83 |
QueryMonitor::init( __FILE__ );
|
readme.txt
CHANGED
@@ -2,10 +2,11 @@
|
|
2 |
Contributors: johnbillion
|
3 |
Tags: debug, debug-bar, debugging, development, developer, performance, profiler, queries, query monitor, rest-api
|
4 |
Requires at least: 3.7
|
5 |
-
Tested up to: 5.
|
6 |
-
Stable tag: 3.6.
|
7 |
License: GPLv2 or later
|
8 |
Requires PHP: 5.3
|
|
|
9 |
|
10 |
Query Monitor is the developer tools panel for WordPress.
|
11 |
|
@@ -86,6 +87,10 @@ In addition, Query Monitor transparently supports add-ons for the Debug Bar plug
|
|
86 |
|
87 |
Please use [the issue tracker on Query Monitor's GitHub repo](https://github.com/johnbillion/query-monitor/issues) as it's easier to keep track of issues there, rather than on the wordpress.org support forums.
|
88 |
|
|
|
|
|
|
|
|
|
89 |
= Is Query Monitor available on WordPress.com VIP Go? =
|
90 |
|
91 |
Yes, it's included as part of the VIP Go platform. However, a user needs to be granted the `view_query_monitor` capability to see Query Monitor even if they're an administrator.
|
@@ -109,13 +114,28 @@ Yes. You can enable this on the Settings panel.
|
|
109 |
|
110 |
= Do you accept donations? =
|
111 |
|
112 |
-
|
|
|
|
|
|
|
|
|
113 |
|
114 |
## Changelog ##
|
115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
### 3.6.4 ###
|
117 |
|
118 |
-
* Correct an error introduced in 3.6.
|
119 |
|
120 |
### 3.6.3 ###
|
121 |
|
@@ -448,15 +468,3 @@ New features! Read about them here: https://querymonitor.com/blog/2019/02/new-fe
|
|
448 |
* Add a bit of vertical breathing room.
|
449 |
* Various improvements to terminology.
|
450 |
* Coding standards.
|
451 |
-
|
452 |
-
### 2.14.0 ###
|
453 |
-
|
454 |
-
* Some more inline documentation about clickable stack traces.
|
455 |
-
* Output a more complete list of error levels and their status.
|
456 |
-
* Internationalisation fixes.
|
457 |
-
* Add some wrapping to the Request and Theme output so posts with long unbroken slugs don't break the layout.
|
458 |
-
* PHP error handler: Add new hook `qm/collect/new_php_error`
|
459 |
-
* Built-in collectors: Add new `qm/built-in-collectors` filter on files before including them
|
460 |
-
* More defensive CSS.
|
461 |
-
* Fix the size of the expand/contract buttons.
|
462 |
-
* Avoid showing two unnecessary functions in the call stack for textdomain loading.
|
2 |
Contributors: johnbillion
|
3 |
Tags: debug, debug-bar, debugging, development, developer, performance, profiler, queries, query monitor, rest-api
|
4 |
Requires at least: 3.7
|
5 |
+
Tested up to: 5.6
|
6 |
+
Stable tag: 3.6.5
|
7 |
License: GPLv2 or later
|
8 |
Requires PHP: 5.3
|
9 |
+
Donate link: https://johnblackbourn.com/donations/
|
10 |
|
11 |
Query Monitor is the developer tools panel for WordPress.
|
12 |
|
87 |
|
88 |
Please use [the issue tracker on Query Monitor's GitHub repo](https://github.com/johnbillion/query-monitor/issues) as it's easier to keep track of issues there, rather than on the wordpress.org support forums.
|
89 |
|
90 |
+
= Is Query Monitor available on Altis? =
|
91 |
+
|
92 |
+
Yes, the [Altis Developer Tools](https://www.altis-dxp.com/resources/developer-docs/dev-tools/) are built on top of Query Monitor.
|
93 |
+
|
94 |
= Is Query Monitor available on WordPress.com VIP Go? =
|
95 |
|
96 |
Yes, it's included as part of the VIP Go platform. However, a user needs to be granted the `view_query_monitor` capability to see Query Monitor even if they're an administrator.
|
114 |
|
115 |
= Do you accept donations? =
|
116 |
|
117 |
+
### Do you accept donations?
|
118 |
+
|
119 |
+
[I am accepting sponsorships via the GitHub Sponsors program](https://johnblackbourn.com/donations/) and any support you can give will help me maintain this plugin and keep it free for everyone.
|
120 |
+
|
121 |
+
In addition, if you like the plugin then I'd love for you to [leave a review](https://wordpress.org/support/view/plugin-reviews/query-monitor). Tell all your friends about it too!
|
122 |
|
123 |
## Changelog ##
|
124 |
|
125 |
+
### 3.6.5 ###
|
126 |
+
|
127 |
+
* Always show the Logs panel, with a link to help docs.
|
128 |
+
* Whole bunch of improvements to QM's "broken" state handling.
|
129 |
+
* Remove usage of deprecated jQuery methods.
|
130 |
+
* Add support for Altis dependencies as components.
|
131 |
+
* Add `innodb_buffer_pool_size` variable to the mysql environment list.
|
132 |
+
* Preformat the Logger output
|
133 |
+
* Fix the PHP version check.
|
134 |
+
|
135 |
+
|
136 |
### 3.6.4 ###
|
137 |
|
138 |
+
* Correct an error introduced in 3.6.2 with the extra early error handling (ironic).
|
139 |
|
140 |
### 3.6.3 ###
|
141 |
|
468 |
* Add a bit of vertical breathing room.
|
469 |
* Various improvements to terminology.
|
470 |
* Coding standards.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|