Skip to content

Conversation

@kloon
Copy link
Contributor

@kloon kloon commented Jun 21, 2019

All Submissions:

Changes proposed in this Pull Request:

This PR introduces a dashboard widget and a banner that notifies and prompts users to upgrade their WordPress and/or PHP if they are outdated and not part of the minimum required versions going into WooCommerce 3.7.

This PR needs to go out in the 3.6 release.

Dashboard Widget

Banner

How to test the changes in this Pull Request:

  1. Checkout branch
  2. Update the WC_MIN_PHP_VERSION and/or WC_MIN_WP_VERSION constants in class-woocommerce.php to versions higher than your current WP and PHP versions.
  3. Check the dashboard widget loads and the banner is displaying
  4. Test dismissing the banner and ensuring the widget also does not load anymore.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?

Changelog entry

New - WordPress & PHP upgrade nudges when running older versions.

@kloon kloon added this to the 3.6.5 milestone Jun 21, 2019
@codecov
Copy link

codecov bot commented Jun 21, 2019

Codecov Report

Merging #23975 into master will decrease coverage by 0.05%.
The diff coverage is 1.47%.

Impacted Files Coverage Δ Complexity Δ
includes/class-woocommerce.php 12.16% <0%> (-0.07%) 84 <0> (ø)
includes/wc-core-functions.php 53.32% <0%> (-0.88%) 0 <0> (ø)
includes/admin/class-wc-admin-dashboard.php 0% <0%> (ø) 49 <11> (+15) ⬆️
includes/admin/class-wc-admin-notices.php 12.42% <11.11%> (-0.08%) 79 <2> (+2)
includes/class-wc-tax.php 80.68% <0%> (-0.26%) 131% <0%> (ø)

@codecov
Copy link

codecov bot commented Jun 21, 2019

Codecov Report

Merging #23975 into master will decrease coverage by 0.01%.
The diff coverage is 13.79%.

Impacted Files Coverage Δ Complexity Δ
includes/admin/class-wc-admin-dashboard.php 0% <ø> (ø) 34 <0> (ø) ⬇️
includes/class-woocommerce.php 12.16% <0%> (-0.07%) 84 <0> (ø)
includes/admin/class-wc-admin-notices.php 11.83% <14.81%> (-0.67%) 88 <11> (+11)
includes/class-wc-install.php 62.22% <0%> (-0.76%) 134% <0%> (+2%)
includes/class-wc-countries.php 77.74% <0%> (ø) 105% <0%> (ø) ⬇️
includes/abstracts/abstract-wc-rest-controller.php 59.49% <0%> (+0.52%) 56% <0%> (ø) ⬇️
...ncludes/shortcodes/class-wc-shortcode-products.php 79.04% <0%> (+1.31%) 76% <0%> (ø) ⬇️

Copy link
Contributor

@claudiosanches claudiosanches left a comment

Choose a reason for hiding this comment

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

Great job!

@kloon
Copy link
Contributor Author

kloon commented Jun 25, 2019

Thanks for review @claudiosanches, going to move this to In Progress again since the banner needs some changes. See p6q8Tx-XP-p2

@kloon kloon added status: in progress This is being worked on. and removed status: approved labels Jun 25, 2019
@kloon kloon added status: needs review and removed status: in progress This is being worked on. labels Jun 25, 2019
@rodrigoprimo rodrigoprimo self-requested a review June 25, 2019 18:16
Copy link
Contributor

@rodrigoprimo rodrigoprimo left a comment

Choose a reason for hiding this comment

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

I left some inline comments with some minor issues that we might want to address before merging this.

Another thing is that the notice is that if the user is running an unsupported WP version and the notice is displayed, it will keep displaying even after WP is updated (I didn't check with a PHP update but I assume the same will happen). Maybe we need to change the code to remove the notice after the update?

@rodrigoprimo rodrigoprimo added needs: author feedback The issue/PR needs a response from any of the parties involved in the issue. and removed status: needs review labels Jun 25, 2019
@peterfabian
Copy link
Contributor

peterfabian commented Jun 26, 2019

As it was implemented previously, the refresh of displaying/not displaying the notice only happened on theme switch (switch_theme) and WooCommerce install (woocommerce_installed).
We could perhaps hook into WP update, but afaik there is no way to hook into PHP version update in the context of WP, thus I think we need to check for WP and PHP versions also in the notice function itself (wp_php_min_requirements_notice), not only when adding the notice. This should cover cases when updating WP and/or PHP, so I've updated it.

Theoretically speaking, the notice would not show if you had 'up to date' versions of WP/PHP, but then decided to downgrade them, but I would guess it's quite an edge case, so I decided to keep the add min notice a part of reset_admin_notices.

@peterfabian peterfabian added status: needs review and removed needs: author feedback The issue/PR needs a response from any of the parties involved in the issue. labels Jun 26, 2019
@peterfabian
Copy link
Contributor

New message formats:
Screenshot 2019-06-26 at 16 41 29

Screenshot 2019-06-26 at 16 42 02

Screenshot 2019-06-26 at 16 44 01

@mikejolley mikejolley mentioned this pull request Jun 26, 2019
2 tasks
Copy link
Contributor

@rodrigoprimo rodrigoprimo 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 the changes, Peter. Looks good to me now.

@rodrigoprimo rodrigoprimo merged commit 698625c into master Jun 26, 2019
@woocommercebot woocommercebot added the release: add changelog Mark all PRs that have not had their changelog entries added. [auto] label Jun 26, 2019
@claudiosanches claudiosanches deleted the add/php-wp-upgrade-notice branch June 26, 2019 17:12
@rodrigoprimo rodrigoprimo added cherry picked and removed release: add changelog Mark all PRs that have not had their changelog entries added. [auto] labels Jul 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants