Make WordPress Core

Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#49686 closed feature request (fixed)

Add hook_extra parameter to upgrader_pre_download filter

Reported by: obliviousharmony's profile obliviousharmony Owned by: desrosj's profile desrosj
Milestone: 5.5 Priority: normal
Severity: minor Version: 5.4
Component: Upgrade/Install Keywords: has-patch has-dev-note
Focuses: Cc:

Description

Hello,

In trying to customize the no_package error for a plugin update, I came across the upgrade_pre_download filter as a really good fit. The only problem with this filter is that it does not contain any information except the path to the package (which is useless in my case as its an empty string) and the upgrader instance. It looks like most of the filters in the WC_Upgrader class are passed the hook_extra argument. I propose we add the parameter to the upgrader_pre_download filter, which does include a plugin key during upgrades!

Change History (19)

This ticket was mentioned in PR #198 on WordPress/wordpress-develop by ObliviousHarmony.


5 years ago
#1

This adds a parameter to the upgrader_pre_download filter that can be used to identify some information about the upgrade. The specific use-case this is being added for is so that we can use the plugin key to figure out which plugin is being updated.

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

#2 @obliviousharmony
5 years ago

  • Keywords has-patch added
  • Version set to trunk

#3 @SergeyBiryukov
5 years ago

  • Milestone changed from Awaiting Review to 5.5

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


5 years ago

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


4 years ago

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


4 years ago

#7 @davidbaumwald
4 years ago

@SergeyBiryukov IS this one still doable with Beta 1 landing in a few days? What else is needed to move this one forward?

#8 @davidbaumwald
4 years ago

  • Keywords needs-dev-note added

Since this changes the filter signature, marking this for a call out on the Misc Dev Note.

#9 @desrosj
4 years ago

  • Owner changed from obliviousharmony to desrosj
  • Status changed from assigned to reviewing

#10 @desrosj
4 years ago

  • Keywords needs-refresh added

@obliviousharmony Thanks for this! I just reviewed the PR over on GitHub with some feedback.

#11 @obliviousharmony
4 years ago

Thanks for the feedback! I've gone ahead and flattened the parameter. For future reference, when responding to a ticket after I've addressed feedback, would I want to remove the needs-refresh keywork?

ObliviousHarmony commented on PR #198:


4 years ago
#12

Thanks for the feedback, I've flattened the array!

#13 @desrosj
4 years ago

  • Keywords needs-refresh removed

Thanks! I'll take a look shortly and try to get this in for 5.5.

Ya, that works. There is currently no syncing for labels or anything between GitHub and Trac. I personally try to keep the Trac ticket updated to reflect the status of the ticket so there is less back and forth!

#14 @desrosj
4 years ago

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

In 48399:

Upgrade/Install: Add hook_extra parameter to the upgrader_pre_download filter.

This provides additional context to code running on this hook, including which plugin or theme update will be downloaded. It also brings consistency to this filter with others throughout the upgrade process.

Props obliviousharmony, desrosj.
Fixes #49686.

ObliviousHarmony commented on PR #198:


4 years ago
#16

Thanks for the feedback! I've gone ahead and flattened the parameter. No need to be so forward-looking :)

ObliviousHarmony commented on PR #198:


4 years ago
#17

Thanks for the feedback! I've gone ahead and flattened the parameter. No need to be so forward-looking :)

#18 @SergeyBiryukov
4 years ago

In 48449:

Docs: Add a @since entry for the $hook_extra parameter added to WP_Upgrader::download_package().

Follow-up to [48399].

See #49686.

#19 @desrosj
4 years ago

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

This received a call out in the Miscellaneous Developer Changes in 5.5 dev note: https://make.wordpress.org/core/2020/07/29/miscellaneous-developer-focused-changes-in-wordpress-5-5/.

Note: See TracTickets for help on using tickets.