Skip to content

Commit

Permalink
Merge branch 'develop' into quicker-close
Browse files Browse the repository at this point in the history
  • Loading branch information
crstauf committed Sep 25, 2024
2 parents 4ad82fa + 9b9a31c commit 56d989a
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 12 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ These are the steps to take to release a new version of Query Monitor (for contr
1. Check [the milestone on GitHub](https://github.com/johnbillion/query-monitor/milestones) for open issues or PRs. Fix or reassign as necessary.
1. If this is a non-patch release, check issues and PRs assigned to the patch or minor milestones that will get skipped. Reassign as necessary.
1. Ensure you're on the `develop` branch and all the changes for this release have been merged in.
1. Ensure both `README.md` and `readme.txt` contain up to date descriptions, "Tested up to" versions, FAQs, screenshots, etc.
1. Ensure `phpstan.neon.dist`, `README.md`, `readme.txt` contain up to date "Tested up to" versions, descriptions, FAQs, screenshots, etc.
- Query Monitor supports the last nine versions of WordPress (support for versions up to approximately three years old)
1. Ensure `.gitattributes` is up to date with all files that shouldn't be part of the build.
- To do this, run `git archive --output=qm.zip HEAD` then check the contents for files that shouldn't be part of the package.
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,7 @@ Debugging is rarely done with just one tool. Along with Query Monitor you should
* [Log HTTP Requests](https://wordpress.org/plugins/log-http-requests/)
* [Rewrite Rules Inspector](https://wordpress.org/plugins/rewrite-rules-inspector/)
* [Snitch](https://wordpress.org/plugins/snitch/)
* [Time Stack](https://github.com/joehoyle/Time-Stack)
* [User Switching](https://wordpress.org/plugins/user-switching/)
* [Variable Inspector](https://wordpress.org/plugins/variable-inspector/)
* [WP Crontrol](https://wordpress.org/plugins/wp-crontrol/)

Query Monitor also has [several add-on plugins](https://querymonitor.com/help/add-on-plugins/) which extend its functionality, and transparently supports add-ons for the Debug Bar plugin (see the FAQ for more info).
Expand Down
10 changes: 8 additions & 2 deletions assets/_styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1500,14 +1500,20 @@ body.admin-color-light #wp-admin-bar-query-monitor:not(.qm-all-clear):not(:hover
}

li {
margin: 0 0 0.7em !important;
list-style: none !important;
margin: 0 0 0.7em 1em !important;
}

.qm-info {
/* @TODO */
color: #666 !important;
}

a.qm-edit-link {
svg {
display: none;
}
}

}

body#error-page {
Expand Down
8 changes: 7 additions & 1 deletion collectors/block_editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,13 @@ public function process() {
$content = $_wp_current_template_content;
} elseif ( is_singular() ) {
// Post editor:
$content = get_post( get_queried_object_id() )->post_content;
$post = get_post( get_queried_object_id() );

if ( ! $post ) {
return;
}

$content = $post->post_content;
} else {
// Nada:
return;
Expand Down
2 changes: 2 additions & 0 deletions collectors/languages.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,10 @@ public function log_mo_file_load( $file, $domain ) {
* @phpstan-return T
*/
public function log_translation_file_load( $file, $domain, string $locale = null ) {
// @phpstan-ignore WPCompat.methodNotAvailable
$i18n_controller = \WP_Translation_Controller::get_instance();

// @phpstan-ignore WPCompat.methodNotAvailable
$found = $i18n_controller->load_file( $file, $domain, $locale ?? determine_locale() );

return $this->log_file_load( $file, $domain, $found );
Expand Down
25 changes: 24 additions & 1 deletion collectors/php_errors.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,32 @@ protected function output_fatal( $error, array $e ) {
continue;
}

$args = array_map( function( $value ) {
$type = gettype( $value );

switch ( $type ) {
case 'object':
return get_class( $value );
case 'boolean':
return $value ? 'true' : 'false';
case 'integer':
case 'double':
return $value;
case 'string':
if ( strlen( $value ) > 50 ) {
return "'" . substr( $value, 0, 20 ) . '...' . substr( $value, -20 ) . "'";
}
return "'" . $value . "'";
}

return $type;
}, $frame['args'] ?? array() );

$name = str_replace( '()', '(' . implode( ', ', $args ) . ')', $callback['name'] );

printf(
'<li>%s</li>',
QM_Output_Html::output_filename( $callback['name'], $frame['file'], $frame['line'] )
QM_Output_Html::output_filename( $name, $frame['file'], $frame['line'] )
); // WPCS: XSS ok.
}
echo '</ol>';
Expand Down
8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@
"codeception/util-universalframework": "^1.0",
"dealerdirect/phpcodesniffer-composer-installer": "0.7.2",
"johnbillion/plugin-infrastructure": "dev-trunk",
"johnbillion/wp-compat": "0.1.0",
"lucatume/wp-browser": "3.2.1",
"phpcompatibility/phpcompatibility-wp": "2.1.4",
"phpstan/phpstan": "1.10.39",
"phpstan/phpstan-phpunit": "1.3.15",
"phpstan/phpstan": "1.12.2",
"phpstan/phpstan-deprecation-rules": "1.2.0",
"phpstan/phpstan-phpunit": "1.4.0",
"roots/wordpress-core-installer": "1.100.0",
"roots/wordpress-full": "*",
"squizlabs/php_codesniffer": "3.7.1",
Expand Down Expand Up @@ -97,7 +99,7 @@
],
"test:phpstan": [
"codecept build",
"phpstan analyze --memory-limit=1024M"
"phpstan analyze -v --memory-limit=1024M"
],
"test:start": [
"tests-start"
Expand Down
2 changes: 1 addition & 1 deletion docs/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ publish: false

Query Monitor is maintained by [John Blackbourn](https://johnblackbourn.com/), one of the team of core committers to the WordPress open source project which he's been involved with for over fifteen years.

John works as a Principal Web Engineer at [Human Made](https://humanmade.com/), one of the world's leading WordPress specialist development agencies, where he leads large scale web publishing platform redevelopment projects for enterprise organisations. He has previously worked at [WordPress VIP](https://wpvip.com/) and [Code For The People](http://codeforthepeople.com/).
John works as Director of WordPress Security at [Human Made](https://humanmade.com/), one of the world's leading WordPress specialist development agencies. He has previously worked at [WordPress VIP](https://wpvip.com/) and [Code For The People](http://codeforthepeople.com/).

John maintains [many other plugins, tools, and resources for WordPress developers](https://johnblackbourn.com/wordpress-developer-tools/).
4 changes: 4 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ includes:
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/szepeviktor/phpstan-wordpress/extension.neon
- vendor/johnbillion/plugin-infrastructure/phpstan/extension.neon
- vendor/johnbillion/wp-compat/extension.neon
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
parameters:
level: 7
paths:
Expand Down Expand Up @@ -34,3 +36,5 @@ parameters:
# Passing ints and floats to these functions is fine
- '#^Parameter \#1 \$text of function (esc_html|esc_attr) expects string, int\|string given#'
- '#^Parameter \#1 \$text of function (esc_html|esc_attr) expects string, float\|int\|string given#'
WPCompat:
requiresAtLeast: '5.8'
4 changes: 3 additions & 1 deletion tests/integration/PluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ private function get_readme() {

$file_contents = implode( '', $file_contents );

preg_match( '|Stable tag:(.*)|i', $file_contents, $_stable_tag );
if ( preg_match( '|Stable tag:(.*)|i', $file_contents, $_stable_tag ) !== 1 ) {
return false;
}

$this->readme_data = array(
'stable_tag' => trim( trim( $_stable_tag[1], '*' ) )
Expand Down

0 comments on commit 56d989a

Please sign in to comment.