Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#50774 closed enhancement (fixed)

include version updated FROM in plugin/theme auto-updates emails

Reported by: pbiron's profile pbiron Owned by: audrasjb's profile audrasjb
Milestone: 5.6 Priority: normal
Severity: normal Version: 5.5
Component: Upgrade/Install Keywords: has-patch needs-testing
Focuses: Cc:

Description

This is a followup to #50350.

In 5.5, when a plugin/theme successfully auto-updates, an email is sent to the site admin listing the plugins/themes and the versions they were updated TO.

The versions they updated FROM would be very helpful, in case admins realize that the update (although successful) causes compatibility problems (with other plugins, etc) and they need to rollback to the previous version (many admins probably won't remember what version they were running).

Unfortunately, by the time the email is generated the version updated FROM is no longer available.

5.6 should refactor the WP_Automatic_Updater so that the version updated FROM is available when the emails are generated.

Attachments (6)

50774.diff (3.1 KB) - added by dkotter 4 years ago.
Screen Shot 2020-08-27 at 4.36.40 PM.png (89.6 KB) - added by dkotter 4 years ago.
Email notification received during tests
50774.1.diff (3.3 KB) - added by audrasjb 4 years ago.
Upgrade/install: Include version updated from in plugin and theme auto-updates email notifications
50774.2.diff (3.7 KB) - added by pbiron 4 years ago.
50774.3.diff (4.9 KB) - added by dkotter 4 years ago.
50774.4.diff (4.9 KB) - added by garrett-eclipse 4 years ago.
Minor refresh from code review to fix grammar of code comments.

Download all attachments as: .zip

Change History (28)

#1 @SergeyBiryukov
4 years ago

  • Milestone changed from Awaiting Review to 5.6

@dkotter
4 years ago

#2 @dkotter
4 years ago

I've uploaded a patch that adds the current plugin and/or theme version to the data that is used when handling auto updates. This current version is then used in the update/failed email for plugins and themes. Current language for this is - plugin/theme (from CURRENT_VERSION to NEW_VERSION).

Happy to update that message if there's something else that makes more sense.

@dkotter
4 years ago

Email notification received during tests

This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.


4 years ago

#4 @pbiron
4 years ago

  • Keywords has-patch needs-testing added

This ticket was mentioned in Slack in #core-auto-updates by audrasjb. View the logs.


4 years ago

#6 @johnbillion
4 years ago

  • Version set to 5.5

@audrasjb
4 years ago

Upgrade/install: Include version updated from in plugin and theme auto-updates email notifications

#7 @audrasjb
4 years ago

  • Owner set to audrasjb
  • Status changed from new to assigned

In 50774.1.diff, I made the "N/A" strings translatable as it may changes from one Locale to another. I contextualized those strings just in case translations would be different in some languages.

This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.


4 years ago

#9 follow-up: @Presskopp
4 years ago

just to mention, I wanted to have this from the beginning, but it was neglegted. Can't remember who said what, but it happened on slack.

#10 in reply to: ↑ 9 @pbiron
4 years ago

I've done some initial testing of 50774.1.diff. It seems to work as expected for plugins hosted in the .org repo.

However, for externally hosted plugins, depending on how the update information is injected into the site transient, the current version may still not be available when the email notifications are sent.

For example, if a plugin hooks into pre_set_site_transient_update_plugins or site_transient_update_plugins to inject their info into $transient->response then current_version will not be set.

With that patch, the only way current_version will be set (to other than "N/A") is if one of the low-level Requests hooks (e.g., http_response) is used to inject the update info...and using those hooks to inject update info for externally hosted plugins is very uncommon in my experience.

I've got a couple of different ideas of how to remedy this, will investigate and upload a revised patch when I've done that.

p.s. all of the above applies to externally hosted themes as well.

@pbiron
4 years ago

#11 @pbiron
4 years ago

50774.2.diff addresses the problem mentioned in comment:10 by setting the current version in WP_Automatic_Updater::update(), rather than trying set in the transient. It also uses "Unknown" as the string if the current version can't be determined, instead of "N/A".

I'm not 100% sold on how the version information appears in the email text, but functionally this works for plugins and themes, whether they are in the .org repo or externally hosted.

This ticket was mentioned in Slack in #core-auto-updates by pbiron. View the logs.


4 years ago

This ticket was mentioned in Slack in #core by jeffpaul. View the logs.


4 years ago

#14 @jorbin
4 years ago

I'm not sure there is much value in unknown being the old version. It feels like it will be of little value, and in that case we might be best keeping the existing string. It keeps the message simple and direct.

This ticket was mentioned in Slack in #core-auto-updates by jeffpaul. View the logs.


4 years ago

@dkotter
4 years ago

#16 @dkotter
4 years ago

50774.3.diff addresses the latest concerns, where if we can't determine the old version number, instead of using the value Unknown, we keep the message the same as it currently is

@garrett-eclipse
4 years ago

Minor refresh from code review to fix grammar of code comments.

#17 @garrett-eclipse
4 years ago

I made a minor refresh of @dkotter latest patch in 50774.4.diff just to update the two comments for grammar. In the below two code comments just changes the to that;

Add the current version so the it can be reported in the notification email.
Add the current version so the it can be reported in the notification email.

This ticket was mentioned in Slack in #core-auto-updates by jeffpaul. View the logs.


4 years ago

This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.


4 years ago

This ticket was mentioned in Slack in #core-auto-updates by pbiron. View the logs.


4 years ago

#21 @helen
4 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 49242:

Upgrade/Install: Include "from" version for plugins/themes in email.

This can help with chasing down any issues that may arise and rolling back if necessary. We hope it's not, but it might be.

Props dkotter, garrett-eclipse, pbiron, audrasjb.
Fixes #50774.

#22 @SergeyBiryukov
4 years ago

In 49249:

Coding Standards: Fix WPCS issues in [49242].

See #50774.

Note: See TracTickets for help on using tickets.