Skip to content

Commit

Permalink
Merge branch 'develop' into fix-309
Browse files Browse the repository at this point in the history
  • Loading branch information
crstauf committed Nov 18, 2024
2 parents 07ed142 + 99a3a14 commit e8d192c
Show file tree
Hide file tree
Showing 17 changed files with 66 additions and 82 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/acceptance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@ jobs:
matrix:
wp:
# Three most recent versions of WordPress
- '6.7-RC1'
- '6.6'
- '6.5'
- '6.4'
php:
# Most recent version of PHP supported by all of the above, plus 7.4
- '8.3'
- '7.4'
include:
# Latest WordPress on PHP 8.4
- wp: '6.6'
- wp: '6.7-RC1'
php: '8.4'
# Oldest supported WordPress
- wp: '5.8'
- wp: '5.9'
php: '7.4'
fail-fast: false
uses: johnbillion/plugin-infrastructure/.github/workflows/reusable-acceptance-tests.yml@trunk
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
strategy:
matrix:
php:
- '8.4'
- '8.3'
- '7.4'
fail-fast: false
Expand Down
22 changes: 21 additions & 1 deletion .github/workflows/deploy-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@ on:
concurrency: WordPress.org

permissions:
attestations: write
contents: read
id-token: write
issues: write

jobs:
test:
deploy:
name: Deploy Tag
uses: johnbillion/plugin-infrastructure/.github/workflows/reusable-deploy-tag.yml@trunk
permissions:
contents: read
issues: write
with:
deploy: ${{ github.event_name != 'workflow_dispatch' }}
plugin: query-monitor
Expand All @@ -29,3 +34,18 @@ jobs:
secrets:
WPORG_SVN_USERNAME: ${{ secrets.WPORG_SVN_USERNAME }}
WPORG_SVN_PASSWORD: ${{ secrets.WPORG_SVN_PASSWORD }}
attest:
name: Generate attestation
runs-on: ubuntu-latest
permissions:
attestations: write
contents: read
id-token: write
timeout-minutes: 70
needs: deploy
steps:
- name: Attest
uses: johnbillion/[email protected]
with:
version: ${{ needs.deploy.outputs.version }}
zip-path: ${{ needs.deploy.outputs.zip-path }}
6 changes: 3 additions & 3 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,19 @@ jobs:
matrix:
wp:
# Three most recent versions of WordPress
- '6.7-RC1'
- '6.6'
- '6.5'
- '6.4'
php:
# Most recent version of PHP supported by all of the above, plus 7.4
- '8.3'
- '7.4'
include:
# Latest WordPress on PHP 8.4
- wp: '6.6'
- wp: '6.7-RC1'
php: '8.4'
# Oldest supported WordPress
- wp: '5.8'
- wp: '5.9'
php: '7.4'
fail-fast: false
with:
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/nightly-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,24 @@ permissions:
contents: read

jobs:
standards:
name: Nightly standards / PHP ${{ matrix.php }}
strategy:
matrix:
php:
- '8.4'
- '8.3'
- '7.4'
fail-fast: false
uses: johnbillion/plugin-infrastructure/.github/workflows/reusable-coding-standards.yml@trunk
with:
php: ${{ matrix.php }}
acceptance:
name: Nightly acceptance / PHP ${{ matrix.php }}
strategy:
matrix:
php:
- '8.4'
- '8.3'
- '7.4'
fail-fast: false
Expand All @@ -44,6 +57,7 @@ jobs:
strategy:
matrix:
php:
- '8.4'
- '8.3'
- '7.4'
fail-fast: false
Expand Down
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 `phpstan.neon.dist`, `README.md`, `readme.txt` contain up to date "Tested up to" versions, descriptions, FAQs, screenshots, etc.
1. Ensure `README.md` and `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: 1 addition & 1 deletion collectors/languages.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public function log_mo_file_load( $file, $domain ) {
* @phpstan-param T $file
* @phpstan-return T
*/
public function log_translation_file_load( $file, $domain, string $locale = null ) {
public function log_translation_file_load( $file, $domain, ?string $locale = null ) {
// @phpstan-ignore WPCompat.methodNotAvailable
$i18n_controller = \WP_Translation_Controller::get_instance();

Expand Down
9 changes: 5 additions & 4 deletions collectors/php_errors.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,17 +203,18 @@ public function error_handler( $errno, $message, $file = null, $line = null, $co
$type = 'notice';
break;

case E_STRICT:
$type = 'strict';
break;

case E_DEPRECATED:
case E_USER_DEPRECATED:
$type = 'deprecated';
break;

}

// E_STRICT is deprecated in PHP 8.4 so it needs to be behind a version check.
if ( null === $type && version_compare( PHP_VERSION, '8.4', '<' ) && E_STRICT === $errno ) {
$type = 'strict';
}

if ( null === $type ) {
return false;
}
Expand Down
34 changes: 3 additions & 31 deletions collectors/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,8 @@ public function filter_template_hierarchy( array $templates ) {
}
}

if ( self::wp_is_block_theme() ) {
$block_theme_folders = self::wp_get_block_theme_folders();
if ( wp_is_block_theme() ) {
$block_theme_folders = get_block_theme_folders();
foreach ( $templates as $template ) {
if ( str_ends_with( $template, '.php' ) ) {
// Standard PHP template, inject the HTML version:
Expand Down Expand Up @@ -520,7 +520,7 @@ public function process() {
$this->data->template => $template_directory,
);

$this->data->theme_folders = self::wp_get_block_theme_folders();
$this->data->theme_folders = get_block_theme_folders();

$stylesheet_theme_json = $stylesheet_directory . '/theme.json';
$template_theme_json = $template_directory . '/theme.json';
Expand All @@ -539,41 +539,13 @@ public function process() {

}

/**
* @return bool
*/
protected static function wp_is_block_theme() {
// WP 5.9
return function_exists( 'wp_is_block_theme' ) && wp_is_block_theme();
}

/**
* @return array<string, string>
*/
protected static function wp_get_block_theme_folders() {
// WP 5.9
if ( ! function_exists( 'get_block_theme_folders' ) ) {
return array(
'wp_template' => 'templates',
'wp_template_part' => 'parts',
);
}

return get_block_theme_folders();
}

/**
* @param string $template_type The current template type.
* @param array<int, string> $template_hierarchy The current template hierarchy, ordered by priority.
* @param string $fallback_template A PHP fallback template to use if no matching block template is found.
* @return WP_Block_Template|null template A template object, or null if none could be found.
*/
protected static function wp_resolve_block_template( $template_type, $template_hierarchy, $fallback_template ) {
// WP 5.8
if ( ! function_exists( 'resolve_block_template' ) ) {
return null;
}

if ( ! current_theme_supports( 'block-templates' ) ) {
return null;
}
Expand Down
13 changes: 7 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"support": {
"issues": "https://github.com/johnbillion/query-monitor/issues",
"forum": "https://wordpress.org/support/plugin/query-monitor",
"security": "https://patchstack.com/database/vdp/query-monitor",
"source": "https://github.com/johnbillion/query-monitor"
},
"funding": [
Expand All @@ -32,15 +33,15 @@
"codeception/util-universalframework": "^1.0",
"dealerdirect/phpcodesniffer-composer-installer": "0.7.2",
"johnbillion/plugin-infrastructure": "dev-trunk",
"johnbillion/wp-compat": "0.1.0",
"johnbillion/wp-compat": "0.2.3",
"lucatume/wp-browser": "3.2.1",
"phpcompatibility/phpcompatibility-wp": "2.1.4",
"phpstan/phpstan": "1.12.2",
"phpstan/phpstan-deprecation-rules": "1.2.0",
"phpcompatibility/phpcompatibility-wp": "2.1.5",
"phpstan/phpstan": "1.12.6",
"phpstan/phpstan-deprecation-rules": "1.2.1",
"phpstan/phpstan-phpunit": "1.4.0",
"roots/wordpress-core-installer": "1.100.0",
"roots/wordpress-full": "*",
"squizlabs/php_codesniffer": "3.7.1",
"roots/wordpress-full": "6.7-RC1",
"squizlabs/php_codesniffer": "3.10.3",
"szepeviktor/phpstan-wordpress": "1.3.5",
"wp-coding-standards/wpcs": "2.3.0"
},
Expand Down
2 changes: 1 addition & 1 deletion docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export default defineConfig({
},

footer: {
copyright: `© 2009-${year}, <a href="/about/">John Blackbourn</a>`,
copyright: `© 2009-${year}, <a href="/about/">John Blackbourn</a>. The WordPress® trademark is the intellectual property of the WordPress Foundation. Query Monitor is not affiliated with the WordPress Foundation.`,
},
},
lastUpdated: true,
Expand Down
28 changes: 2 additions & 26 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"icons": "sharp -i .wordpress-org/icon.svg -o .wordpress-org/icon-128x128.png -f png --palette resize 128 128 && sharp -i .wordpress-org/icon.svg -o .wordpress-org/icon-256x256.png -f png --palette resize 256 256 && sharp -i .wordpress-org/icon-light.svg -o docs/assets/logo.png -f png --palette resize 256 256",
"build": "sass --no-source-map assets/query-monitor.scss assets/query-monitor.css",
"watch": "sass --watch --poll assets/query-monitor.scss assets/query-monitor.css",
"version": "npm install # See https://github.com/JS-DevTools/version-bump-prompt/issues/42",
"docs:dev": "vitepress dev docs",
"docs:build": "vitepress build docs",
"docs:preview": "vitepress preview docs"
Expand Down
2 changes: 1 addition & 1 deletion phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

<rule ref="WordPress.WP.DeprecatedFunctions">
<properties>
<property name="minimum_supported_version" value="5.8" />
<property name="minimum_supported_version" value="5.9" />
</properties>
</rule>

Expand Down
2 changes: 0 additions & 2 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,3 @@ 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'
2 changes: 1 addition & 1 deletion query-monitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Author URI: https://querymonitor.com/
* Text Domain: query-monitor
* Domain Path: /languages/
* Requires at least: 5.8
* Requires at least: 5.9
* Requires PHP: 7.4
* License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* License: GPL v2 or later
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Contributors: johnbillion
Tags: debug, debug-bar, development, performance, query monitor
Tested up to: 6.6
Tested up to: 6.7
Stable tag: 3.16.4
License: GPLv2 or later
Donate link: https://github.com/sponsors/johnbillion
Expand Down

0 comments on commit e8d192c

Please sign in to comment.