Opened 4 years ago
Closed 4 years ago
#52381 closed enhancement (fixed)
Add filter for results of `WP_Upgrader::install_package()`
Reported by: | afragen | Owned by: | afragen |
---|---|---|---|
Milestone: | 5.7 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Upgrade/Install | Keywords: | has-patch early commit |
Focuses: | Cc: |
Description (last modified by )
Adding a filter to the result of install_package()
in WP_Upgrader::install_package()
allows for the capture and usage of error data resulting from the install_package()
function.
The proposed filter additionally allows for a potential plugin/theme rollback in the event of an update failure due to copy_dir()
, but more generally a failure during install_package()
. A rollback feature for plugin/theme update failures was originally proposed in #51857.
A feature plugin Rollback Update Failure is available for testing utilizing this filter.
Change History (12)
This ticket was mentioned in PR #925 on WordPress/wordpress-develop by afragen.
4 years ago
#1
#3
@
4 years ago
- Description modified (diff)
- Owner set to afragen
- Status changed from new to assigned
- Summary changed from Add filter for results of `copy_dir()` in WP_Upgrader to Add filter for results of `WP_Upgrader::install_package()`
Moved filter to more general upgrader_install_complete
after the install_package()
process.
This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.
4 years ago
#5
@
4 years ago
Update from today's core scrub: this ticket is ready for a code review and then it can be committed for 5.7 Beta 1.
This ticket was mentioned in Slack in #core by afragen. View the logs.
4 years ago
#7
@
4 years ago
Reviewing PR925, it took me quite some time to figure out exactly why it's wanted/required/needed.
Philosophically I feel that upgrader_pre_install
and upgrader_post_install
should've covered these, however the latter is only run on a successful call to install_package()
, and that's written into a lot of existing code, so changing it's behaviour isn't really possible.
Adding a filter, potentially marked as temporary for a feature plugin, makes sense to me, but I'd probably just call it upgrader_install_package_result
instead.
#8
@
4 years ago
PR updated for upgrader_install_package_result
Yes, the idea with this filter is to pick up a failure of install_package()
not a success as upgrader_post_install
picks up.
Adding a filter to the result of
copy_dir()
inWP_Upgrader::install_package()
allows for the capture and usage of error data resulting from thecopy_dir()
function.The proposed filter additionally allows for a potential plugin/theme rollback in the event of an update failure due to
copy_dir()
. A rollback feature for plugin/theme update failures was originally proposed in #51857.A feature plugin Rollback Update Failure is available for testing utilizing this filter.
Trac ticket: https://core.trac.wordpress.org/ticket/52381