Make WordPress Core

Opened 4 years ago

Last modified 4 years ago

#50674 accepted enhancement

Plugin and Theme Update Hooks

Reported by: davidbaumwald's profile davidbaumwald Owned by: pbiron's profile pbiron
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Upgrade/Install Keywords: 2nd-opinion needs-patch
Focuses: Cc:

Description

With plugin and theme auto-updates shipping with core in 5.5, I think it's worth considering adding some more hooks around the plugin and theme process to perhaps run prior to and after a particular update is run. Hooks like plugin_updated and theme_updated, and maybe some pre_* versions of those.

Change History (11)

#1 @pbiron
4 years ago

@davidbaumwald WP_Upgrader and WP_Automatic_Upgrader already have a number of hooks like that, e.g.

Do you have specific use cases that those don't cover?

Last edited 4 years ago by pbiron (previous) (diff)

#2 @davidbaumwald
4 years ago

I had considered upgrader_process_complete for my specific use-case, but you have to weed through a bunch of data to determine the object being updated. I was thinking of more granular hooks that fired globally when a plugin/theme is updated, auto or manual.

#3 @desrosj
4 years ago

  • Version trunk deleted

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


4 years ago

#5 @pbiron
4 years ago

@davidbaumwald Do you still have need for more specific hooks? If so, can you provide use cases where existing hooks don't work? If not, feel free to close this :-)

#6 @davidbaumwald
4 years ago

@pbiron It's not that the existing hooks "don't work" for the use-cases I've encountered. The request here is a quality of life enhancement. Instead of digging through the existing hooks to determine the type and item(s) affected, it would be nice to have more granular filters that apply to a specific update type and pass a single item.

Since plugin and theme auto-updates are now part of core, the number of potential use-cases for these types of hooks has increased for developers who need to detect when things update, since they can now be unattended.

#7 @pbiron
4 years ago

  • Milestone changed from Awaiting Review to 5.6
  • Owner set to pbiron
  • Status changed from new to accepted

Sorry if I wasn't clear: I'm definitely not against adding additional hooks...just looking to you to tell us which new hooks to add :-)

I'm adding this to the 5.6 milestone.

#8 @davidbaumwald
4 years ago

@pbiron They could either be dynamic:

  do_action( "pre_upgrade_{$type}", $type, $object );

Or they could be split up into the individual skins and set to static, like:

  do_action( 'pre_upgrade_plugin', $object );

It would also be nice to have the upgrade_XXX companions to fire _after_ the upgrade is processed.

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


4 years ago

#10 @helen
4 years ago

  • Keywords needs-patch added

#11 @hellofromTonya
4 years ago

  • Milestone changed from 5.6 to Future Release

Per scrub today, Beta 1 is tomorrow. Moving this ticket to Future Release.

If any maintainer or committer feels this can be resolved in time, or wishes to assume ownership during a specific cycle, feel free to update the milestone accordingly.

Note: See TracTickets for help on using tickets.