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

General: Fail on load if using unsupported WP. #11609

Merged
merged 9 commits into from Mar 25, 2019

Conversation

kraftbj
Copy link
Contributor

@kraftbj kraftbj commented Mar 19, 2019

Replaces and closes #11572

Every normal way of updating Jetpack will not allow us to update to on an unsupported version of WordPress, but we can just be extra careful in the event someone runs an unexpected upgrade (e.g. via FTP, Git, etc).

Changes proposed in this Pull Request:

  • Abort Jetpack if running on an unsupported WP version.

Testing instructions:

  • JN site running WP 4.9
  • Install, activate, and setup Jetpack 7.1.1
  • Using git, checkout this branch (unbuilt is fine for testing).

If checking out master, it'll hard fatal. If checking out this branch, Jetpack will still be active, but there will be an admin_notice requesting an upgrade to keep using Jetpack.

Proposed changelog entry for your changes:

  • Harden forced support for supported WordPress versions.

@kraftbj kraftbj added this to the 7.2 milestone Mar 19, 2019
@kraftbj kraftbj requested a review from a team as a code owner March 19, 2019 14:37
@jetpackbot
Copy link

jetpackbot commented Mar 19, 2019

Thank you for the great PR description!

When this PR is ready for review, please apply the [Status] Needs Review label. If you are an a11n, please have someone from your team review the code if possible. The Jetpack team will also review this PR and merge it to be included in the next Jetpack release.

Scheduled Jetpack release: April 2, 2019.
Scheduled code freeze: March 26, 2019

Generated by 🚫 dangerJS against 3d4e5e9

jetpack.php Show resolved Hide resolved
jetpack.php Outdated Show resolved Hide resolved
jetpack.php Outdated Show resolved Hide resolved
jetpack.php Show resolved Hide resolved
@kraftbj kraftbj added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] Needs Review To request a review from Crew. Label will be renamed soon. and removed DO NOT MERGE don't merge it! [Status] In Progress labels Mar 19, 2019
@kraftbj kraftbj changed the title POC: Fail on load if using unsupported WP. General: Fail on load if using unsupported WP. Mar 19, 2019
Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

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

Quick i18n change.

jetpack.php Outdated Show resolved Hide resolved
@jeherve jeherve added [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! and removed [Status] Needs Review To request a review from Crew. Label will be renamed soon. labels Mar 20, 2019
Co-Authored-By: kraftbj <public@brandonkraft.com>
@kraftbj kraftbj added [Status] Needs Review To request a review from Crew. Label will be renamed soon. and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Mar 22, 2019
Copy link
Member

@mdawaffe mdawaffe left a comment

Choose a reason for hiding this comment

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

Works well.

I'm not sure if this is in scope or not, but going to /wp-admin/admin.php?page=jetpack in WordPress 4.9 just displays the "Sorry, you are not allowed to access this page." error (since the jetpack menu item is never created).

Should we add a stub menu item there that just contains the new admin notice?

jetpack.php Outdated Show resolved Hide resolved
*/
function jetpack_admin_unsupported_wp_notice() { ?>
<div class="notice notice-error is-dismissible">
<p><?php esc_html_e( 'Jetpack requires a more recent version of WordPress and has been paused. Please update WordPress to continue enjoying Jetpack.', 'jetpack' ); ?></p>
Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense to provide the user with a link to support to help them achive updating of WordPress.
also does do we show this to everyone.
Even non admins?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As it stands, it shows to everyone. I'm okay not changing behavior though because it would only been shown on sites that upgraded to Jetpack in some atypical way and with Jetpack not working, it would be pretty apparent to anyone who used any feature.

Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

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

This works well in my tests. 👍 It's not as pretty as the other banners you can get when Jetpack actually runs so it may not be as visible (it's easier to miss if you have other banners already installed), but it does the trick!

@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! General and removed [Status] Needs Review To request a review from Crew. Label will be renamed soon. labels Mar 25, 2019
@jeherve
Copy link
Member

jeherve commented Mar 25, 2019

cc @danjjohnson This is important, as it will potentially happen to some of our users in the next release. I would recommend preparing a predef explaining to folks the need to update to WP 5.0, the mininum supported version of WordPress, if they want to continue to use Jetpack. We may mention the classic editor plugin in there since I assume some people have refrained from updating because their site is not ready for the block editor.

@kraftbj
Copy link
Contributor Author

kraftbj commented Mar 25, 2019

To add on, this is normal for Jetpack (only supporting the current and last previous major version of WP), so we're only being a bit extra cautious since it's been awhile since we bumped previous versions due to the long development cycle of 5.0.

@kraftbj kraftbj merged commit b871747 into master Mar 25, 2019
@ghost ghost removed the [Status] Ready to Merge Go ahead, you can push that green button! label Mar 25, 2019
@kraftbj kraftbj deleted the add/bail-on-unsupported-wp branch March 25, 2019 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
General [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants