Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin: Remove compat layers for WP 6.4 and 6.5 #64096

Merged
merged 9 commits into from
Jul 31, 2024

Conversation

Mamaduka
Copy link
Member

What?

PR removes compat layers for WP 6.4 and 6.5. This is usually done after each release.

How?

  • Remove compat files.
  • Fix any errors that appear in logs.

Testing Instructions

  • All CI checks are green.
  • Smoke test editors and front-end view. They should work as before.
  • There are no PHP warnings/errors in logs.

Testing Instructions for Keyboard

Same.

@Mamaduka Mamaduka added Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts [Type] Code Quality Issues or PRs that relate to code quality labels Jul 30, 2024
@Mamaduka Mamaduka self-assigned this Jul 30, 2024
@Mamaduka
Copy link
Member Author

cc @WordPress/gutenberg-core

Copy link

github-actions bot commented Jul 30, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: talldan <talldanwp@git.wordpress.org>
Co-authored-by: hellofromtonya <hellofromtonya@git.wordpress.org>
Co-authored-by: creativecoder <grantmkin@git.wordpress.org>
Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>
Co-authored-by: dmsnell <dmsnell@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

lib/load.php Outdated
@@ -188,28 +122,6 @@ function gutenberg_is_experiment_enabled( $name ) {
// Fonts API / Font Face.
remove_action( 'plugins_loaded', '_wp_theme_json_webfonts_handler' ); // Turns off WordPress 6.0's stopgap handler.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hellofromtonya, do we still need this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Mamaduka no longer needed as of 6.4.0.

That callback was deprecated and its associated add_action() hook was removed in 6.4.0 via r56500.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @hellofromtonya!

@Mamaduka Mamaduka mentioned this pull request Jul 30, 2024
@sirreal sirreal self-requested a review July 30, 2024 18:34
@Mamaduka
Copy link
Member Author

The remaining PHPUnit test failure comes from a test introduced in #60354. Based on the description, it seems like a back-sync from the core (WP 6.5), but I can find a similar test at https://github.com/WordPress/wordpress-develop.

cc @creativecoder

Copy link

Flaky tests detected in fac3b3d.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/10168055536
📝 Reported issues:

@dmsnell
Copy link
Member

dmsnell commented Jul 30, 2024

Much of the 6.6 HTML API code relies on the 6.5 compat layer. They will need to be updated and brought over as the _6_6 variants otherwise code will crash when those _6_5 classes are missing.

Copy link
Member

@ramonjd ramonjd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Mamaduka!!

I've tested the features I'm most familiar with:

✅ revision REST API related functionality (lib/compat/wordpress-6.4/class-gutenberg-rest-global-styles-revisions-controller-6-4.php)
✅ date translations (lib/compat/wordpress-6.5/script-loader.php)
✅ background CSS validation (lib/compat/wordpress-6.5/kses.php)
✅ deleting draft patterns (lib/compat/wordpress-6.4/blocks.php)

@t-hamano
Copy link
Contributor

Is this PR intended to drop support for WP 6.4 and WP 6.5? If so, I think the "Requires at least" field also needs to be updated to 6.6.

Otherwise, we will likely encounter critical errors in older WordPress versions.

Here is an example of the error:

Fatal error: Uncaught Error: Call to undefined function get_all_registered_block_bindings_sources() in /var/www/html/wp-content/plugins/gutenberg/lib/compat/wordpress-6.6/block-bindings/pattern-overrides.php:49
Stack trace:
#0 /var/www/html/wp-includes/class-wp-hook.php(324): gutenberg_register_block_bindings_pattern_overrides_source('')
#1 /var/www/html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#2 /var/www/html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#3 /var/www/html/wp-settings.php(643): do_action('init')
#4 /var/www/html/wp-config.php(142): require_once('/var/www/html/w...')
#5 /var/www/html/wp-load.php(50): require_once('/var/www/html/w...')
#6 /var/www/html/wp-blog-header.php(13): require_once('/var/www/html/w...')
#7 /var/www/html/index.php(17): require('/var/www/html/w...')
#8 {main} thrown in /var/www/html/wp-content/plugins/gutenberg/lib/compat/wordpress-6.6/block-bindings/pattern-overrides.php on line 49

Also, I remember that the Gutenberg plugin customarily supported one version older.

@ramonjd
Copy link
Member

ramonjd commented Jul 31, 2024

I think the "Requires at least" field also needs to be updated to 6.6.

Good point! I think @Mamaduka also raised previously that performance tests hashes might need an update?

https://github.com/WordPress/gutenberg/pull/56464/files#r1402992768

@talldan
Copy link
Contributor

talldan commented Jul 31, 2024

@Mamaduka Is it right that the 6.5 folder is being removed? My understanding is that Gutenberg usually supports the last two WordPress versions (current stable and previous), so that would usually mean only removing the 6.4 folder. I can't find any written confirmation of that, though! Maybe this changed at some point, and I'm not aware.

Here's a link to one of the previous times this was done - #60780

Edit - actually I think you're right, here's a couple more PRs:

They both removed the folder for the version previous to the current release, as this PR does.

@talldan talldan requested a review from ajitbohra as a code owner July 31, 2024 03:02
@talldan
Copy link
Contributor

talldan commented Jul 31, 2024

There's also some code in the button block that can be removed so I've pushed a commit - #63115

@talldan talldan linked an issue Jul 31, 2024 that may be closed by this pull request
@t-hamano
Copy link
Contributor

Can we also remove this fallback code for WP6.4?

/*
* The class_list method was only added in 6.4 so this needs a temporary fallback.
* This fallback should be removed when the minimum supported version is 6.4.
*/
$classes = $processor->get_attribute( 'class' );
if ( $classes ) {
$classes = explode( ' ', $classes );
foreach ( $classes as $class_name ) {
if ( str_contains( $class_name, 'is-layout-' ) ) {
array_push( $layout_classes, $class_name );
$processor->remove_class( $class_name );
}
}
}

@Mamaduka
Copy link
Member Author

The "Requires at least" field needs to be updated to 6.5. The plugin supports the latest two major releases.

Updating the "Requires at least" field and performance hash were usually done separately.

@Mamaduka
Copy link
Member Author

Here's the PR for bumping versions and perf job SHA - #64126.

@talldan talldan added the No Core Sync Required Indicates that any changes do not need to be synced to WordPress Core label Jul 31, 2024
Copy link
Contributor

@talldan talldan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for handling this.

I've smoke tested 6.5 and 6.6 with the build from this PR and haven't spotted any issues.

Also not seeing anything that stands out in the code, it all looks good to me. Nice job!

@Mamaduka Mamaduka merged commit 0af7e14 into trunk Jul 31, 2024
65 of 66 checks passed
@Mamaduka Mamaduka deleted the remove/legacy-wp-compat-files branch July 31, 2024 05:52
@github-actions github-actions bot added this to the Gutenberg 19.0 milestone Jul 31, 2024
@sirreal sirreal removed their request for review September 10, 2024 14:34
sirreal added a commit that referenced this pull request Sep 10, 2024
These are no longer used in Core or Gutenberg.

See https://core.trac.wordpress.org/ticket/60970.

This only seems to have existed in the 6.5 compat directory, removed in #64096.

---

Co-authored-by: sirreal <jonsurrell@git.wordpress.org>
Co-authored-by: swissspidy <swissspidy@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts No Core Sync Required Indicates that any changes do not need to be synced to WordPress Core [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Button Block: Remove backwards compatibility code for WP6.4
7 participants