Version Description
Download this release
Release Info
Developer | johnbillion |
Plugin | Query Monitor |
Version | 3.8.1 |
Comparing to | |
See all releases |
Code changes from version 3.8.0 to 3.8.1
- classes/Activation.php +2 -2
- classes/PHP.php +45 -0
- classes/Plugin.php +0 -42
- classes/Util.php +22 -0
- output/Headers.php +0 -4
- output/Raw.php +0 -4
- output/headers/php_errors.php +3 -5
- query-monitor.php +8 -6
- readme.txt +8 -15
- wp-content/db.php +4 -4
classes/Activation.php
CHANGED
@@ -13,7 +13,7 @@ class QM_Activation extends QM_Plugin {
|
|
13 |
protected function __construct( $file ) {
|
14 |
|
15 |
# PHP version handling
|
16 |
-
if ( !
|
17 |
add_action( 'all_admin_notices', array( $this, 'php_notice' ) );
|
18 |
return;
|
19 |
}
|
@@ -127,7 +127,7 @@ class QM_Activation extends QM_Plugin {
|
|
127 |
echo esc_html( sprintf(
|
128 |
/* Translators: 1: Minimum required PHP version, 2: Current PHP version. */
|
129 |
__( 'The Query Monitor plugin requires PHP version %1$s or higher. This site is running version %2$s.', 'query-monitor' ),
|
130 |
-
|
131 |
PHP_VERSION
|
132 |
) );
|
133 |
?>
|
13 |
protected function __construct( $file ) {
|
14 |
|
15 |
# PHP version handling
|
16 |
+
if ( ! QM_PHP::version_met() ) {
|
17 |
add_action( 'all_admin_notices', array( $this, 'php_notice' ) );
|
18 |
return;
|
19 |
}
|
127 |
echo esc_html( sprintf(
|
128 |
/* Translators: 1: Minimum required PHP version, 2: Current PHP version. */
|
129 |
__( 'The Query Monitor plugin requires PHP version %1$s or higher. This site is running version %2$s.', 'query-monitor' ),
|
130 |
+
QM_PHP::$minimum_version,
|
131 |
PHP_VERSION
|
132 |
) );
|
133 |
?>
|
classes/PHP.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* PHP version compatibility functionality.
|
4 |
+
*
|
5 |
+
* @package query-monitor
|
6 |
+
*/
|
7 |
+
|
8 |
+
abstract class QM_PHP {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @var string
|
12 |
+
*/
|
13 |
+
public static $minimum_version = '5.3.6';
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @return bool
|
17 |
+
*/
|
18 |
+
public static function version_met() {
|
19 |
+
return version_compare( PHP_VERSION, self::$minimum_version, '>=' );
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @return void
|
24 |
+
*/
|
25 |
+
public static function php_version_nope() {
|
26 |
+
printf(
|
27 |
+
'<div id="qm-php-nope" class="notice notice-error is-dismissible"><p>%s</p></div>',
|
28 |
+
wp_kses(
|
29 |
+
sprintf(
|
30 |
+
/* translators: 1: Required PHP version number, 2: Current PHP version number, 3: URL of PHP update help page */
|
31 |
+
__( 'The Query Monitor plugin requires PHP version %1$s or higher. This site is running PHP version %2$s. <a href="%3$s">Learn about updating PHP</a>.', 'query-monitor' ),
|
32 |
+
self::$minimum_version,
|
33 |
+
PHP_VERSION,
|
34 |
+
'https://wordpress.org/support/update-php/'
|
35 |
+
),
|
36 |
+
array(
|
37 |
+
'a' => array(
|
38 |
+
'href' => array(),
|
39 |
+
),
|
40 |
+
)
|
41 |
+
)
|
42 |
+
);
|
43 |
+
}
|
44 |
+
|
45 |
+
}
|
classes/Plugin.php
CHANGED
@@ -13,11 +13,6 @@ abstract class QM_Plugin {
|
|
13 |
*/
|
14 |
private $plugin = array();
|
15 |
|
16 |
-
/**
|
17 |
-
* @var string
|
18 |
-
*/
|
19 |
-
public static $minimum_php_version = '5.3.6';
|
20 |
-
|
21 |
/**
|
22 |
* @var string
|
23 |
*/
|
@@ -94,42 +89,5 @@ abstract class QM_Plugin {
|
|
94 |
}
|
95 |
return $this->plugin[ $item ] . ltrim( $file, '/' );
|
96 |
}
|
97 |
-
|
98 |
-
/**
|
99 |
-
* @return bool
|
100 |
-
*/
|
101 |
-
public static function php_version_met() {
|
102 |
-
static $met = null;
|
103 |
-
|
104 |
-
if ( null === $met ) {
|
105 |
-
$met = version_compare( PHP_VERSION, self::$minimum_php_version, '>=' );
|
106 |
-
}
|
107 |
-
|
108 |
-
return $met;
|
109 |
-
}
|
110 |
-
|
111 |
-
/**
|
112 |
-
* @return void
|
113 |
-
*/
|
114 |
-
public static function php_version_nope() {
|
115 |
-
printf(
|
116 |
-
'<div id="qm-php-nope" class="notice notice-error is-dismissible"><p>%s</p></div>',
|
117 |
-
wp_kses(
|
118 |
-
sprintf(
|
119 |
-
/* translators: 1: Required PHP version number, 2: Current PHP version number, 3: URL of PHP update help page */
|
120 |
-
__( 'The Query Monitor plugin requires PHP version %1$s or higher. This site is running PHP version %2$s. <a href="%3$s">Learn about updating PHP</a>.', 'query-monitor' ),
|
121 |
-
self::$minimum_php_version,
|
122 |
-
PHP_VERSION,
|
123 |
-
'https://wordpress.org/support/update-php/'
|
124 |
-
),
|
125 |
-
array(
|
126 |
-
'a' => array(
|
127 |
-
'href' => array(),
|
128 |
-
),
|
129 |
-
)
|
130 |
-
)
|
131 |
-
);
|
132 |
-
}
|
133 |
-
|
134 |
}
|
135 |
}
|
13 |
*/
|
14 |
private $plugin = array();
|
15 |
|
|
|
|
|
|
|
|
|
|
|
16 |
/**
|
17 |
* @var string
|
18 |
*/
|
89 |
}
|
90 |
return $this->plugin[ $item ] . ltrim( $file, '/' );
|
91 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
}
|
93 |
}
|
classes/Util.php
CHANGED
@@ -253,6 +253,26 @@ class QM_Util {
|
|
253 |
default:
|
254 |
$name = __( 'Unknown', 'query-monitor' );
|
255 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
256 |
/**
|
257 |
* Filters the name of a custom or unknown component.
|
258 |
*
|
@@ -261,6 +281,7 @@ class QM_Util {
|
|
261 |
* See also the corresponding filters:
|
262 |
*
|
263 |
* - `qm/component_dirs`
|
|
|
264 |
* - `qm/component_context/{$type}`
|
265 |
*
|
266 |
* @since 3.6.0
|
@@ -279,6 +300,7 @@ class QM_Util {
|
|
279 |
* See also the corresponding filters:
|
280 |
*
|
281 |
* - `qm/component_dirs`
|
|
|
282 |
* - `qm/component_name/{$type}`
|
283 |
*
|
284 |
* @since 3.8.0
|
253 |
default:
|
254 |
$name = __( 'Unknown', 'query-monitor' );
|
255 |
|
256 |
+
/**
|
257 |
+
* Filters the type of a custom or unknown component.
|
258 |
+
*
|
259 |
+
* The dynamic portion of the hook name, `$type`, refers to the component identifier.
|
260 |
+
*
|
261 |
+
* See also the corresponding filters:
|
262 |
+
*
|
263 |
+
* - `qm/component_dirs`
|
264 |
+
* - `qm/component_name/{$type}`
|
265 |
+
* - `qm/component_context/{$type}`
|
266 |
+
*
|
267 |
+
* @since 3.8.1
|
268 |
+
*
|
269 |
+
* @param string $type The component type.
|
270 |
+
* @param string $file The full file path for the file within the component.
|
271 |
+
* @param string $name The component name.
|
272 |
+
* @param string $context The context for the component.
|
273 |
+
*/
|
274 |
+
$type = apply_filters( "qm/component_type/{$type}", $type, $file, $name, $context );
|
275 |
+
|
276 |
/**
|
277 |
* Filters the name of a custom or unknown component.
|
278 |
*
|
281 |
* See also the corresponding filters:
|
282 |
*
|
283 |
* - `qm/component_dirs`
|
284 |
+
* - `qm/component_type/{$type}`
|
285 |
* - `qm/component_context/{$type}`
|
286 |
*
|
287 |
* @since 3.6.0
|
300 |
* See also the corresponding filters:
|
301 |
*
|
302 |
* - `qm/component_dirs`
|
303 |
+
* - `qm/component_type/{$type}`
|
304 |
* - `qm/component_name/{$type}`
|
305 |
*
|
306 |
* @since 3.8.0
|
output/Headers.php
CHANGED
@@ -6,10 +6,6 @@
|
|
6 |
*/
|
7 |
|
8 |
abstract class QM_Output_Headers extends QM_Output {
|
9 |
-
/**
|
10 |
-
* @return array<string, mixed>
|
11 |
-
*/
|
12 |
-
abstract public function get_output();
|
13 |
|
14 |
/**
|
15 |
* @return void
|
6 |
*/
|
7 |
|
8 |
abstract class QM_Output_Headers extends QM_Output {
|
|
|
|
|
|
|
|
|
9 |
|
10 |
/**
|
11 |
* @return void
|
output/Raw.php
CHANGED
@@ -6,8 +6,4 @@
|
|
6 |
*/
|
7 |
|
8 |
abstract class QM_Output_Raw extends QM_Output {
|
9 |
-
/**
|
10 |
-
* @return array<string, mixed>
|
11 |
-
*/
|
12 |
-
abstract public function get_output();
|
13 |
}
|
6 |
*/
|
7 |
|
8 |
abstract class QM_Output_Raw extends QM_Output {
|
|
|
|
|
|
|
|
|
9 |
}
|
output/headers/php_errors.php
CHANGED
@@ -38,11 +38,9 @@ class QM_Output_Headers_PHP_Errors extends QM_Output_Headers {
|
|
38 |
|
39 |
$count++;
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
$component = $error['trace']->get_component()->name;
|
45 |
-
$stack = $error['trace']->get_stack();
|
46 |
} else {
|
47 |
$component = __( 'Unknown', 'query-monitor' );
|
48 |
$stack = array();
|
38 |
|
39 |
$count++;
|
40 |
|
41 |
+
if ( $error['component'] ) {
|
42 |
+
$component = $error['component']->name;
|
43 |
+
$stack = wp_list_pluck( $error['filtered_trace'], 'display' );
|
|
|
|
|
44 |
} else {
|
45 |
$component = __( 'Unknown', 'query-monitor' );
|
46 |
$stack = array();
|
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.8.
|
14 |
* Plugin URI: https://querymonitor.com/
|
15 |
* Author: John Blackbourn
|
16 |
* Author URI: https://querymonitor.com/
|
@@ -33,17 +33,19 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
33 |
exit;
|
34 |
}
|
35 |
|
|
|
|
|
36 |
$qm_dir = dirname( __FILE__ );
|
37 |
|
38 |
-
require_once "{$qm_dir}/classes/
|
39 |
|
40 |
-
if ( !
|
41 |
-
add_action( 'admin_notices', '
|
42 |
return;
|
43 |
}
|
44 |
|
45 |
# No autoloaders for us. See https://github.com/johnbillion/query-monitor/issues/7
|
46 |
-
foreach ( array( 'Activation', 'Util', 'QM' ) as $qm_class ) {
|
47 |
require_once "{$qm_dir}/classes/{$qm_class}.php";
|
48 |
}
|
49 |
|
5 |
* @package query-monitor
|
6 |
* @link https://github.com/johnbillion/query-monitor
|
7 |
* @author John Blackbourn <john@johnblackbourn.com>
|
8 |
+
* @copyright 2009-2022 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.8.1
|
14 |
* Plugin URI: https://querymonitor.com/
|
15 |
* Author: John Blackbourn
|
16 |
* Author URI: https://querymonitor.com/
|
33 |
exit;
|
34 |
}
|
35 |
|
36 |
+
define( 'QM_VERSION', '3.8.1' );
|
37 |
+
|
38 |
$qm_dir = dirname( __FILE__ );
|
39 |
|
40 |
+
require_once "{$qm_dir}/classes/PHP.php";
|
41 |
|
42 |
+
if ( ! QM_PHP::version_met() ) {
|
43 |
+
add_action( 'admin_notices', 'QM_PHP::php_version_nope' );
|
44 |
return;
|
45 |
}
|
46 |
|
47 |
# No autoloaders for us. See https://github.com/johnbillion/query-monitor/issues/7
|
48 |
+
foreach ( array( 'Plugin', 'Activation', 'Util', 'QM' ) as $qm_class ) {
|
49 |
require_once "{$qm_dir}/classes/{$qm_class}.php";
|
50 |
}
|
51 |
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ 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.8
|
6 |
-
Stable tag: 3.8.
|
7 |
License: GPLv2 or later
|
8 |
Requires PHP: 5.3
|
9 |
Donate link: https://johnblackbourn.com/donations/
|
@@ -141,6 +141,13 @@ In addition, if you like the plugin then I'd love for you to [leave a review](ht
|
|
141 |
|
142 |
## Changelog ##
|
143 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
### 3.8.0 ###
|
145 |
|
146 |
* Introduces the ability for a third party to cease all further data collection and output at any point by calling `do_action( 'qm/cease' )`, for example to prevent memory exhaustion during long-running operations
|
@@ -453,17 +460,3 @@ New features! Read about them here: https://querymonitor.com/blog/2019/02/new-fe
|
|
453 |
* Better handling of environments with unlimited execution time or memory limit. Adds a warning for both.
|
454 |
* When an external cache isn't in use, provide some helpful info if an appropriate extension is installed.
|
455 |
|
456 |
-
|
457 |
-
### 3.0.1 ###
|
458 |
-
|
459 |
-
* Add even more hardening to the JS handling to prevent problems when jQuery is broken.
|
460 |
-
* Remove the old `no-js` styles which don't work well with the new UI.
|
461 |
-
* Correct the logic for showing the `Non-Core` component filter option.
|
462 |
-
* Add another VIP function to the list of functions that call the HTTP API.
|
463 |
-
* Add an inline warning highlight to capability checks that are empty or of a non-string type.
|
464 |
-
* Add support for WordPress.com VIP Client MU plugins.
|
465 |
-
* Add support for displaying laps as part of the timing information.
|
466 |
-
* Add full support for namespaced Debug Bar add-on panels.
|
467 |
-
* Switch back to depending on `jquery` instead of `jquery-core`.
|
468 |
-
* Don't assume `php_uname()` is always callable. Add info about the host OS too.
|
469 |
-
* Reset inline height attribute when the panel is closed.
|
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.8
|
6 |
+
Stable tag: 3.8.1
|
7 |
License: GPLv2 or later
|
8 |
Requires PHP: 5.3
|
9 |
Donate link: https://johnblackbourn.com/donations/
|
141 |
|
142 |
## Changelog ##
|
143 |
|
144 |
+
### 3.8.1 ###
|
145 |
+
|
146 |
+
* Fixes an incompatibility with PHP versions prior to 7.2
|
147 |
+
* Fixes a warning that was being triggered within the PHP header dispatcher
|
148 |
+
* Introduces the `qm/component_type/{$type}` filter
|
149 |
+
* Introduces a `QM_VERSION` constant
|
150 |
+
|
151 |
### 3.8.0 ###
|
152 |
|
153 |
* Introduces the ability for a third party to cease all further data collection and output at any point by calling `do_action( 'qm/cease' )`, for example to prevent memory exhaustion during long-running operations
|
460 |
* Better handling of environments with unlimited execution time or memory limit. Adds a warning for both.
|
461 |
* When an external cache isn't in use, provide some helpful info if an appropriate extension is installed.
|
462 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wp-content/db.php
CHANGED
@@ -33,14 +33,14 @@ if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
|
|
33 |
|
34 |
# No autoloaders for us. See https://github.com/johnbillion/query-monitor/issues/7
|
35 |
$qm_dir = dirname( dirname( __FILE__ ) );
|
36 |
-
$
|
37 |
|
38 |
-
if ( ! is_readable( $
|
39 |
return;
|
40 |
}
|
41 |
-
require_once $
|
42 |
|
43 |
-
if ( !
|
44 |
return;
|
45 |
}
|
46 |
|
33 |
|
34 |
# No autoloaders for us. See https://github.com/johnbillion/query-monitor/issues/7
|
35 |
$qm_dir = dirname( dirname( __FILE__ ) );
|
36 |
+
$qm_php = "{$qm_dir}/classes/PHP.php";
|
37 |
|
38 |
+
if ( ! is_readable( $qm_php ) ) {
|
39 |
return;
|
40 |
}
|
41 |
+
require_once $qm_php;
|
42 |
|
43 |
+
if ( ! QM_PHP::version_met() ) {
|
44 |
return;
|
45 |
}
|
46 |
|