WordPress.org

Make WordPress Core

Opened 3 months ago

Closed 2 months ago

Last modified 3 weeks ago

#50052 closed enhancement (fixed)

Plugins & Themes Auto-Updates πŸ€–

Reported by: whyisjake Owned by: whyisjake
Milestone: 5.5 Priority: normal
Severity: normal Version: trunk
Component: Security Keywords: needs-testing needs-design-feedback needs-docs has-patch has-dev-note
Focuses: ui, administration Cc:

Description (last modified by audrasjb)

WordPress Auto-updates πŸ€–

With the maturity of the ​WordPress AutoUpdates plugin, let's get this merged to core for WordPress 5.5.

Recent Changes

0.7.0 🦒

May 6, 2020

0.6.0 πŸ¦‹

April 22, 2020

  • Add Ajax to Plugin and Themes Screen - ​#61
  • Accessibility: Communicate AJAX enabling/disabling changes to screen readers - ​#85
  • Add Better Handling to Ajax Errors - ​#90
  • Prevent CSS from being enqueued on sub-site plugins & themes screens in multisite - ​#91

0.5.1 πŸ¦’

April 16, 2020

  • Add the plugin version when enqueueing styles, for cache busting - ​#79

0.5.0 🦚

April 15, 2020

  • Replace Disable strings with Disable auto-updates - ​#78
  • Update confirmation message wording - ​#77
  • Remove Automatic Updates column from the Network Admin > Sites > Edit > Themes screen - ​#76
  • Replace "Enable" string with "Enable auto-updates" - ​#75
  • Remove dashicons from the UI - ​#74
  • Fix documentation and comment standards - ​#73
  • Remove green and red colors on texts and links - ​#70
  • Don't display the Enable/Disable link in the Theme Details modal on a subsite in multisite - ​#68
  • Documentation: Improve DocBlocks - ​#62
  • I18n - Merge with similar string - ​#60
  • Add filters and constant to allow developers to disable plugins and themes autoupdate email notifications - ​#57
  • Switch disable link to red on Multisite Themes Screen - ​#54
  • Wrong kick off year in readme.txt - ​#42

0.4.1 🍺

April 2, 2020

  • Network > Sites > Edit > Themes screen doesn’t have the Autoupdates column - ​#50

0.4.0 🌹

March 30, 2020

This release brings full support for Themes auto-updates.

It also changes the plugin structure to allow self deactivation when the feature gets merged into WordPress Core.

Please note: the development repository was also migrated from @audrasjb’s personal GitHub account to WordPress.org official GitHub account.

Other changes:

  • Change plugin structure to ensure it can self-deactivate when the feature is merged into Core - ​#37
  • Handle both themes and plugins email notifications - ​#36
  • i18n: Merge similar translation strings - ​#35

Add and populate Automatic updates column, add and handle enable/disable auto-updates bulk actions to the multisite themes list * table - ​#33

  • Avoid duplicate Updating… dialog - ​#32

Attachments (4)

50052.diff​ (62.0 KB) - added by pbiron 3 months ago.
50052.2.diff​ (65.7 KB) - added by pbiron 3 months ago.
refreshes against trunk and adds a few changes from the forthcoming version 0.8.1 of the feature plugin
50052.3.diff​ (65.3 KB) - added by azaozz 3 months ago.
Diff from ​https://github.com/WordPress/wordpress-develop/pull/281
50052.4.diff​ (1.5 KB) - added by whyisjake 2 months ago.

Download all attachments as: .zip

Change History (54)

#1 @whyisjake
3 months ago

  • Keywords needs-patch needs-testing needs-design-feedback needs-codex needs-docs added
  • Milestone changed from Awaiting Review to 5.5
  • Type changed from defect (bug) to enhancement
  • Version set to trunk

#2 @audrasjb
3 months ago

  • Keywords needs-dev-note added

Related: #48850, #49199

#3 @whyisjake
3 months ago

  • Focuses ui administration added
  • Keywords needs-dev-note removed

#4 @whyisjake
3 months ago

  • Owner set to whyisjake
  • Status changed from new to accepted

#5 @whyisjake
3 months ago

  • Component changed from General to Security

#6 follow-ups: @afercia
3 months ago

One of the criteria to merge features-as-plugins into core is that the new code meets the WordPress coding standards.

​https://make.wordpress.org/core/handbook/about/release-cycle/features-as-plugins/#feature-plugin-merge-criteria

The code conforms to the WordPress coding standards.

Looking at the latest version of the plugin on GitHub, I see the main JS file needs quite a bit of adjustments to meet the coding standards. See ​https://github.com/WordPress/wp-autoupdates/blob/3c7032b7310569e830a9dadcab0fdb06cacba23e/js/wp-autoupdates.js

#7 in reply to: ↑ 6 @pbiron
3 months ago

Replying to afercia:

Looking at the latest version of the plugin on GitHub, I see the main JS file needs quite a bit of adjustments to meet the coding standards.

Agreed. See ​PR: Fix enabled/disabled count updating for the first step towards that goal.

#8 in reply to: ↑ 6 @pbiron
3 months ago

Replying to afercia:

Looking at the latest version of the plugin on GitHub, I see the main JS file needs quite a bit of adjustments to meet the coding standards.

See ​Simplifies Ajax on both the JS and PHP sides. for a more complete attempt to correct that (which is intended to superseded the other PR I linked to yesterday).

#9 @afercia
3 months ago

@pbiron thanks for clarifying. I was concerned ​the post published on Make 3 days ago claimed the feature plugin as "ready for a core merge", while it appears it's not ready, yet.

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


3 months ago

#11 @jorbin
3 months ago

Some things worth testing that I remember from Shiny Updates v1 (though not super well, it's been a while):

1) make sure to test plugins who's update contains syntax errors. ​https://plugins.trac.wordpress.org/browser/this-plugin-should-not-be-used exists for this purpose. You can install version 0.1 and then if you update to 0.2, there is a syntax error.

2) There are some JS events that plugins rely on with updates. Should make sure that there are adequate replacements if needed. See #37216 #37512

3) There is alot of logic for ftp/ssh credentials in the existing workflow. Obviously won't matter for autoupdates, but we should ensure it's not broken for manual updates

#12 @pbiron
3 months ago

@jorbin Thank you. Can you also open an issue on the ​Feature Plugin repo so we have your thoughts there as well?

#13 @jorbin
3 months ago

@pbiron no. This isn't an issue with the plugin, this is thoughts of what needs to happen for core which is developed here.

#14 @audrasjb
3 months ago

  • Description modified (diff)

Updated the description of the ticket to add last plugin version.

@pbiron
3 months ago

#15 @pbiron
3 months ago

  • Keywords has-patch added; needs-patch removed

50052.diff contains all the functionality from version 0.8.0 of the feature plugin (to be released shortly), except for the help tabs, because the copy for those isn't ready yet.

#16 @azaozz
3 months ago

50052.diff looks good here.

Can see couple of tiny optimizations/improvements, like setting __( 'Auto-updates enabled' ) to a var as it is used in two loops in WP_Debug_Data, but really minor thing. Also perhaps breaking up the long lines for printf() in WP_List_Table for better readability, another minor thing :)

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


3 months ago

#18 follow-up: @audrasjb
3 months ago

  • Keywords needs-dev-note added; needs-codex removed

I tested/compared each feature with the feature plugin ones, and I didn't see any issue on the proposed patch.
Thanks for putting this together @pbiron!


I also took the time to list all those who contributed to the development of this feature from version 0.1.0 to 0.8.0, so they can get props on the first commit of this ticket:

audrasjb, xkon, azaozz, desrosj, pbiron, gmays, pedromendonca, javiercasares, karmatosed, 
mapk, afercia, gmays, knutsp, whodunitagency, passionate, nicolaskulka, bookdude13, whyisjake, 
nielsdeblaauw, mukesh27, wpamitkumar, netweb, afragen, davidperonne, paaljoachim

Thanks y'all for your contributions!

Last edited 3 months ago by audrasjb (previous) (diff)

This ticket was mentioned in ​Slack in #core-site-health by pbiron. ​View the logs.


3 months ago

@pbiron
3 months ago

refreshes against trunk and adds a few changes from the forthcoming version 0.8.1 of the feature plugin

#20 @whyisjake
3 months ago

This is looking great, and I think we are ready for merge. @azaozz anything else to add?

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


3 months ago

#22 @TimothyBlynJacobs
3 months ago

Seems like wp_is_auto_update_enabled_for_type would be useful in wp-includes/update.php since it seems like it isn't just about the admin UI.

The logic in the WP_Automatic_Updater seems wrong to me. As far as I can tell, this will stop autoupdates being triggered from the API if the corresponding filter is disabled. I think it should be...

<?php
$update =  ! empty( $item->autoupdate );
if ( ! $update && wp_is_auto_update_enabled_for_type( $type ) ) {
    $auto_updates = (array) get_site_option( "auto_update_{$type}s", array() );
    $update      = in_array( $item->{$type}, $auto_updates, true );
}

This ticket was mentioned in ​PR #279 on ​WordPress/wordpress-develop by ​whyisjake.


3 months ago

PR to bring auto-updates to WordPress themes and plugins.

This is an extension of ​https://github.com/WordPress/wp-autoupdates

Trac ticket: https://core.trac.wordpress.org/ticket/50052

This ticket was mentioned in ​PR #280 on ​WordPress/wordpress-develop by ​whyisjake.


3 months ago

PR to bring auto-updates to WordPress themes and plugins.

Closing #279 in favor of this updated PR.

This is an extension of ​https://github.com/WordPress/wp-autoupdates

Trac ticket: https://core.trac.wordpress.org/ticket/50052

#25 @prbot
3 months ago

​whyisjake commented on ​PR #279:

Thanks to @ocean90 and @TimothyBJacobs for their comments here. Moving over to #280 for a proper forked pull request.

This ticket was mentioned in ​PR #281 on ​WordPress/wordpress-develop by ​azaozz.


3 months ago

Trac ticket: https://core.trac.wordpress.org/ticket/50052

This is an extension/additional PR to @whyisjake branch: ​https://github.com/whyisjake/wordpress-develop/tree/auto-updates-50052 that contains the core patch for "Plugin and Theme Auto-Updates".

#27 @azaozz
3 months ago

Thinking 50052.3.diff is ready for commit. There may be few places where the code perhaps can be a bit more readable or simplified, but it overall follows the way the pre-existing/surrounding code was written.

#28 in reply to: ↑ 18 @pbiron
3 months ago

Replying to audrasjb:

I also took the time to list all those who contributed to the development of this feature from version 0.1.0 to 0.8.0, so they can get props on the first commit of this ticket:

audrasjb, xkon, azaozz, desrosj, pbiron, gmays, pedromendonca, javiercasares, karmatosed, 
mapk, afercia, gmays, knutsp, whodunitagency, passionate, nicolaskulka, bookdude13, whyisjake, 
nielsdeblaauw, mukesh27, wpamitkumar, netweb, afragen, davidperonne, paaljoachim

Thanks y'all for your contributions!

passionate should be passoniate

#29 @whyisjake
3 months ago

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

In 47835:

Security: Add user interface to auto-update themes and plugins.

Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.

Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.

#30 @prbot
3 months ago

​whyisjake commented on ​PR #281:

Merged!

#31 @prbot
3 months ago

​whyisjake commented on ​PR #280:

Merged!

#32 follow-up: @SergeyBiryukov
3 months ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Great work, everyone! Reopening for some minor cleanup.

Could these two filters use a consistent naming pattern?

  • auto_plugin_update_send_email
  • send_theme_auto_update_email

For reference, here are the other three new filters:

  • auto_plugin_theme_update_email
  • wp_plugins_auto_update_enabled
  • wp_themes_auto_update_enabled

Do the latter two need the wp_ prefix?

Last edited 3 months ago by SergeyBiryukov (previous) (diff)

#33 @SergeyBiryukov
3 months ago

In 47836:

Docs: Add missing @since tag for auto_plugin_theme_update_email filter.

See #50052.

#34 @garrett-eclipse
3 months ago

@SergeyBiryukov 's question mimicks the one I posted to #core-auto-updates, for reference;
​https://wordpress.slack.com/archives/CULBN711P/p1589999882115000

#35 in reply to: ↑ 32 ; follow-up: @pbiron
3 months ago

Replying to SergeyBiryukov:

Great work, everyone! Reopening for some minor cleanup.

Could these two filters use a consistent naming pattern?

  • auto_plugin_update_send_email
  • send_theme_auto_update_email

For reference, here are the other three new filters:

  • auto_plugin_theme_update_email
  • wp_plugins_auto_update_enabled
  • wp_themes_auto_update_enabled

Do the latter two need the wp_ prefix?

send_theme_auto_update_email should be changed to auto_theme_update_send_email.

For reference, the existing filter for whether to send core auto-update notifications is auto_core_update_send_email. I changed the filter name for plugin auto-update notifications (from what is in the feature plugin) to have that form, but it looks like I just forgot to change the one for themes.

As for the wp_ prefix, they have that prefix in the feature plugin and since there are ALOT of existing filters in core with that prefix I didn't think to remove it. I have no objection to removing it. @audrasjb what do you think?

#36 in reply to: ↑ 35 @audrasjb
3 months ago

As for the wp_ prefix, they have that prefix in the feature plugin and since there are ALOT of existing filters in core with that prefix I didn't think to remove it. I have no objection to removing it. @audrasjb what do you think?

No objection either πŸ‘

#37 @SergeyBiryukov
3 months ago

In 47840:

Coding Standards: Fix WPCS issues in wp-admin/includes/class-wp-debug-data.php.

Follow-up to [47550], [47557], [47835].

See #50052.

#38 @desrosj
2 months ago

Great work here everyone! Great to see this get merged. I did some testing today, and have a bit of feedback.

First, a bug that I found on the themes page.

  • Click on Theme Details for a theme.
  • Click "Enable auto-updates".
  • Auto-updates are correctly enabled.
  • Close that theme's overlay.
  • Click on Theme Details for the same theme and note that it says "Enable auto-updates" again.
  • Refresh the page and view that theme again to see auto-updates is correctly enabled.

The emails also feel like they are lacking a bit of context. For example, the site is not linked to anywhere in the email. It's also not clear if any action is required when receiving the email, and there's no direction where they should navigate if they experience issues.

I think the first two sentences in the Core update email could be repurposed a bit:

Howdy! Some plugins and/or themes on your site at ​https://site.com have been updated automatically to new versions.

No further action is needed on your part. Here are some helpful links for managing plugins and themes on your site:

It's possible that this could have been discussed previously and I missed it while I was out on leave.

I also agree with @SergeyBiryukov and @pbiron above that send_theme_auto_update_email should be changed to auto_theme_update_send_email and I don't think that the wp_ prefix is necessarily needed.

The filters could also be moved into the if( ! empty( $update_results['type'] ) ) checks. This is probably a micro-optimization, but this would ensure the filters only run when there are actually updates for that filter type.

I'll continue testing and update with anything else I find!

#39 @whyisjake
2 months ago

I missed giving props to @ronalfy on the commit. Going to work that in on an update.

Last edited 2 months ago by whyisjake (previous) (diff)

#40 @whyisjake
2 months ago

In 47857:

Coding Standards: Change auto-update filters to be more consistent.

  • send_theme_auto_update_email πŸ‘‰ auto_theme_update_send_email
  • wp_plugins_auto_update_enabled πŸ‘‰ plugins_auto_update_enabled
  • wp_themes_auto_update_enabled πŸ‘‰ themes_auto_update_enabled

Want to make sure that @ronalfy gets props for his work in #50052 too.

See #50052.
Props: ronalfy, pbiron, azaozz, audrasjb, whyisjake.

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


2 months ago

#42 @desrosj
2 months ago

I branched out #50268 for improving the emails.

#43 @whyisjake
2 months ago

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

I am going to close this ticket again since we covered the filter name changes. Future issues, like #50268, can be opened as needed.

#44 @johnbillion
7 weeks ago

In 48097:

Docs: Corrections and improvements to inline docs related to plugin and theme auto-updates.

See #50052, #49572

#45 @SergeyBiryukov
6 weeks ago

In 48148:

I18N: Include placeholder in translator comments in wp_get_auto_update_message().

See #50436, #50052.

This ticket was mentioned in ​Slack in #accessibility by afercia. ​View the logs.


6 weeks ago

#47 @johnbillion
6 weeks ago

In 48183:

Docs: Clarify the description of functions that check for and perform updates.

See #49572, #50052.

This ticket was mentioned in ​Slack in #design by afercia. ​View the logs.


5 weeks ago

#49 @afercia
3 weeks ago

In 48479:

Accessibility: Security: Improves the accessible audible messages for Plugins & Themes Auto-Updates.

  • changes the politeness level of the two error messages introduced in [47835] to assertive
  • remove unnecessary polite parameters as that's the default value

See #50512, #50052.

Note: See TracTickets for help on using tickets.