Make WordPress Core

Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#50875 closed enhancement (fixed)

Introduce a wrapper for the 'auto_update_{$type}' filter checks

Reported by: sergeybiryukov's profile SergeyBiryukov Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.6 Priority: normal
Severity: normal Version:
Component: Upgrade/Install Keywords: dev-feedback has-patch needs-refresh
Focuses: Cc:

Description

Background: #50868

Looking at [48750], using the $type variable was necessary to reference the canonical name of the filter, but with the filter applied in quite a few places, that increases the chances of a conflict with an existing $type variable used elsewhere.

I think this would benefit from having a dedicated function as a wrapper for the filter, something like wp_is_auto_update_forced_for_type(), similar to wp_is_auto_update_enabled_for_type().

Attachments (1)

50875.diff (2.1 KB) - added by rebasaurus 3 years ago.
First attempt...let me know if this is what you were thinking you had in mind.

Download all attachments as: .zip

Change History (10)

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


3 years ago

#2 @SergeyBiryukov
3 years ago

  • Keywords needs-patch added

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


3 years ago

@rebasaurus
3 years ago

First attempt...let me know if this is what you were thinking you had in mind.

#4 @rebasaurus
3 years ago

  • Keywords dev-feedback has-patch added; needs-patch removed

#5 @SergeyBiryukov
3 years ago

  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#6 @garrett-eclipse
3 years ago

  • Keywords needs-refresh added

Thanks for the patch @rebasaurus, a couple notes;

  1. You'll want to update the since to 5.6.0 if it's to land in the upcoming major.
  2. Along with building the wrapper you'll want to apply it throughout core. The function should be applied to all instances of "auto_update_{$type}" as can be found in this changeset.
  3. The descriptions of the @params on the filters blocks should all align starting one space after the longer parameter name.
Last edited 3 years ago by garrett-eclipse (previous) (diff)

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


3 years ago

#8 @SergeyBiryukov
3 years ago

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

In 49241:

Upgrade/Install: Introduce a wrapper for the auto_update_{$type} filter checks.

This allows for cleaner checks whether auto-updates are forced for a plugin or theme.

Follow-up to [48750].

Props rebasaurus, garrett-eclipse, SergeyBiryukov.
Fixes #50875.

#9 @SergeyBiryukov
3 years ago

In 49243:

Upgrade/Install: Restore casting $filter_payload to an object in WP_MS_Themes_List_Table::prepare_items().

Follow-up to [48750], [49241].

See #50875.

Note: See TracTickets for help on using tickets.