#37512 closed defect (bug) (fixed)
Shiny Updates: Trigger a JS event when deleting/installing themes/plugins
Reported by: | DavidAnderson | Owned by: | jorbin |
---|---|---|---|
Milestone: | 4.6 | Priority: | normal |
Severity: | normal | Version: | 4.6 |
Component: | Upgrade/Install | Keywords: | has-patch commit |
Focuses: | javascript, administration | Cc: |
Description
In #37216, triggers were added to Shiny Updates to enable the existing functionality of our plugin to continue working with the changed theme update implementation. (Our plugin pops up a dialog, communicates with the back-end via AJAX to perform a backup of the site's themes, and then when the backup is complete hands back control so that the update proceeds).
Further testing has revealed another issue - the "Shiny Deletes" for plugins or themes don't work with our plugin active, and there's no way for us to hook in to make it work.
The cause is the lack of an analogous trigger on the deletion event (corresponding to the existing triggers on the update event).
The attached patch adds triggers upon plugin and theme deletion. It also adds triggers in the corresponding location upon plugin and theme install; we don't use that, but it ought to be there for completeness and to allow other plugin authors to hook in.
Attachments (5)
Change History (18)
#1
@
8 years ago
The corresponding patch that was committed for #37216: https://core.trac.wordpress.org/attachment/ticket/37216/37216.diff
#2
@
8 years ago
- Keywords has-patch added
- Summary changed from WC 4.6 RC 1 - missing JS triggers in Shiny Updates / Deletes to Shiny Updates: Trigger a JS event when deleting/installing themes/plugins
Wouldn't it be helpful to know which plugin/theme was deleted/installed/updated?
#3
@
8 years ago
You're right - we don't use that, but some consumers could find that handy. I've added that in the revised patch (including adding it to the theme and plugin updates triggers - the theme update trigger is new in WP 4.6, but the plugin update trigger exists since 4.2).
#4
@
8 years ago
- Milestone changed from Awaiting Review to 4.6
Yeah, passing the additional info makes sense. args
contains the success and error callbacks though, not sure that's super helpful. Would it perhaps suffice to pass only the slug?
#5
@
8 years ago
After much more testing, I've just provided a third version that adds a further trigger for the bulk action, which previously did not trigger anything (this also broke our code - not sure why we didn't catch this in the earlier testing when beta 1 came out).
@swissspidy: I was thinking that by passing args, we passed everything, so it's more future-proofed against any changes in what arguments there might be. I don't feel strongly either way though (we don't actually use the parameter).
#6
@
8 years ago
'wp-plugin-bulk-action-' + bulkAction
should probably be 'wp-plugin-bulk-' + bulkAction
(i.e. without the -action
part), otherwise trigger-update-delete-and-install3.diff looks fine.
#7
@
8 years ago
The bulk action handler is also used for themes. So maybe wp-' + type + '-bulk-' + bulkAction
?
@
8 years ago
V5: Adjust to reflect fact that the bulk action handler can be invoked for themes as well as plugins
#8
@
8 years ago
- Keywords commit added
@DavidAnderson Thanks!
FYI: Attachments don't trigger notifications so you should always post an additional comment when uploading a patch.
#9
@
8 years ago
- Owner set to jorbin
- Status changed from new to reviewing
@jorbin Can you review trigger-update-delete-and-install5.diff please?
Add triggers upon shiny deletes and installs corresponding to those already present for updates