Opened 10 years ago
Closed 9 years ago
#30441 closed enhancement (fixed)
New action hook in auto-upgrade process
Reported by: | DavidAnderson | Owned by: | DrewAPicture |
---|---|---|---|
Milestone: | 4.4 | Priority: | normal |
Severity: | normal | Version: | 3.7 |
Component: | Upgrade/Install | Keywords: | has-patch dev-feedback |
Focuses: | Cc: |
Description
The attached patch adds an action hook in the automatic (background) upgrading process.
I have a need for such a hook in a plugin. (I wish to record some state information pre-update). Currently, if you want to do this, then it's very ugly and hackish: the nearest you can get is to use the should_update filter, and duplicate part of the WP_Automatic_Updater::should_update() method within your filter (the part that comes after the filter is called - because that can also prevent the update). And even so, it's a filter: someone else might decide to call it for a different reason other than a real update going ahead, so, you've also got to do stuff with doing_action() to make sure of your context.
Attachments (2)
Change History (12)
#1
in reply to:
↑ description
@
10 years ago
Replying to DavidAnderson:
the nearest you can get is to use the should_update filter
I meant to say, "the auto_update_* filters".
#3
@
10 years ago
- Focuses docs added
The filter needs to be documented as per the documentation standards.
#6
@
9 years ago
Is there any reason this hasn't been added yet? I was very surprised to find out there is no reliable way to trigger a backup of important files, db data, do notifications, etc. prior to updates.
It would be worthwhile having similar hooks for manual updates, too, considering it's easy to just update everything and brick a site because of some minor error or plugin conflict.
Add action call before background updates