[wp-trac] [WordPress Trac] #34617: Add filter for shiny updates
WordPress Trac
noreply at wordpress.org
Mon Nov 9 03:56:38 UTC 2015
#34617: Add filter for shiny updates
-----------------------------+------------------------------
Reporter: afragen | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Upgrade/Install | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch close | Focuses:
-----------------------------+------------------------------
Comment (by afragen):
Replying to [comment:10 dd32]:
> Replying to [comment:9 afragen]:
> > Let me explain what happens. The plugin updates from GitHub source and
downloads as `user-repo-hash`, instead of just `repo`. I use the
`upgrader_post_install` filter to rename to `repo` but in shiny updates
the referenced function gets the original destination and passes it.
Because of this the new, updated plugin location isn't referenced and
later in that function the `get_plugins` call is to the original location
that doesn't exist.
>
> Ah. So the problem is that you're not updating the value of
`destination_name` which is returned from the upgrader instance to what
you're renamed it to - which is what the Ajax handler relies upon to
correctly identify that the plugins folder has changed.
But I am updating `destination_name` in `upgrader_post_install`.
> I'm specifically referring to this line which runs before that filter:
> {{{
> $this->result = compact( 'source', 'source_files', 'destination',
'destination_name', 'local_destination', 'remote_destination',
'clear_destination' );
> }}}
It seems that when AJAX updating occurs my code is firing and renaming the
destinations. Somewhere the `$upgrader->bulk_upgrade()` doesn't have a
post-processing filter.
> I still don't think the filter you've proposed is correct, and that
using the `upgrader_post_install` filter as you are doing so is also the
incorrect thing to do. Kind of feels like `upgrader_source_selection`
might be a better option to rename it on, you can probably just rename the
source folder to what you want it to be and return that there.
To be clearer, my code already correctly renames the destination and the
plugin update occurs correctly to the new destination even when using
shiny updates. The issue is that in shiny updates the original destination
is retrieved from `wp_ajax_update_plugin()` and I can't get the correct
new version number.
FWIW, `upgrader_post_install` is much simpler to rename from than
`upgrader_source_selection` based upon the parameters that are passed with
each filter, at least for my purposes. ;)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34617#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list