Bump WordPress and PHP minimum#917
Conversation
| * Require PHP version 5.6 - throw an error if the plugin is activated on an older version. | ||
| * Require PHP 7.4+, WP 5.7+ - throw an error if the plugin is activated on an older version. | ||
| */ | ||
| register_activation_hook( |
There was a problem hiding this comment.
These changes prevent activation of the plugin on unsupported versions of WP, PHP.
There is now the small risk a site will have an active plugin and update to a version it no longer supports. How have we handled that in the past?
There was a problem hiding this comment.
So I was trying to find a version of this in our plugins and couldn't quite remember where it's at but what we've done in the past is have some code in the main plugin file (so this file in this case) that checks if our requirements are met and if not, output an admin notice and stop execution of the plugin. Not our plugin but here's a similar approach in a Woo plugin: https://github.com/woocommerce/google-listings-and-ads/blob/develop/google-listings-and-ads.php#L41 and https://github.com/woocommerce/google-listings-and-ads/blob/develop/src/Internal/Requirements/VersionValidator.php#L22
There was a problem hiding this comment.
In 6187c56 I've added a first pass at showing a notice if the plugin fails to meet minimum version requirements.
Honestly, it seems like a lot for something that ought to be quite minor but I am not sure if there is much that can be done about that. For this to work, the plugin's main file will always need to be compatible with earlier versions of WP/PHP. The up-to-date code will need to come later.
Should I move some of the bootstrapping code so distributor.php can focus on activation & a bootstrapper can focus on bootstrapping?
0d61a5f to
a3bcc0a
Compare
1fb3610 to
3437cc2
Compare
# Conflicts: # readme.txt
| $post = isset( $_GET['post'] ) ? get_post( (int) $_GET['post'] ) : false; // @codingStandardsIgnoreLine Nonce not required | ||
|
|
||
| if ( $post && ! \Distributor\Utils\is_using_gutenberg( $post ) ) { | ||
| add_action( 'do_meta_boxes', __NAMESPACE__ . '\replace_revisions_meta_box', 10, 3 ); | ||
| add_action( 'add_meta_boxes', __NAMESPACE__ . '\add_revisions_meta_box' ); | ||
| } | ||
| add_action( 'do_meta_boxes', __NAMESPACE__ . '\replace_revisions_meta_box', 10, 3 ); | ||
| add_action( 'add_meta_boxes', __NAMESPACE__ . '\add_revisions_meta_box' ); |
There was a problem hiding this comment.
The is_using_gutenberg() function call is moved to the do_meta_boxes hook where it is used. This ensures all the editor functions are defined before attempting to use them. Specifically, in this instance, use_block_editor_for_post_type().
Expand explanation of internal helper to document why it exists.
…ype` is defined.
ca74e75 to
2a7eed0
Compare
302e302 to
9415023
Compare
Instead of reproducing the function (including the final filter) call the function if it exists. Otherwise go through the polyfill steps.
# Conflicts: # distributor.php
d4fa229 to
7be0237
Compare
iamdharmesh
left a comment
There was a problem hiding this comment.
Thanks a lot for the great work here @peterwilsoncc, Code looks good to me just want you to check on the notes below.
-
I think we should also add minimum requirements in the plugin header of the plugin’s main PHP file as well. Since WordPress 5.8 plugin readme files are not parsed for requirements. This means that headers
Requires PHPandRequires at leastare going to be parsed from plugin’s main PHP file.
Thanks
|
@iamdharmesh I've added the requirements to the main plugin file in c1c93fb You'll need to run |
|
Thanks for adding requirements to the main plugin file @peterwilsoncc.
Yes, I am already doing this, but it seems the URL to load CSS file is wrong. it is Thanks |
Co-authored-by: Dharmesh Patel <dspatel44@gmail.com>
Sorry, I missed that in the screen shot. I've merged in your chagne |
iamdharmesh
left a comment
There was a problem hiding this comment.
Thanks for the changes @peterwilsoncc. All looks good to me now. 🚀
Thanks for your amazing work here.
Co-authored-by: Darin Kotter <darin.kotter@gmail.com>
e3c3999

Description of the Change
Bump WordPress minimum to 5.7
Bump PHP minimum to 7.4
Closes #905, Closes #925
How to test the Change
Changelog Entry
Credits
Props @peterwilsoncc, @vikrampm1, @iamdharmesh.
Checklist: