[wp-trac] [WordPress Trac] #34617: Add filter for shiny updates

WordPress Trac noreply at wordpress.org
Mon Nov 9 03:33:37 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:
-----------------------------+------------------------------
Changes (by dd32):

 * keywords:  has-patch => has-patch close


Comment:

 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.

 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' );
 }}}

 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.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34617#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list