[wp-trac] [WordPress Trac] #30945: WP_Upgrader: Incorrect plugin folder after updating from remote (non-WP) URL

WordPress Trac noreply at wordpress.org
Thu Jan 8 02:52:58 UTC 2015


#30945: WP_Upgrader: Incorrect plugin folder after updating from remote (non-WP)
URL
-------------------------------+------------------------------
 Reporter:  miyarakira         |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Plugins            |     Version:  4.1
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------------------

Comment (by miyarakira):

 I attached an example of a zip file in the second format (I believe).  It
 throws an error during install: "Plugin contains no files".  But, you can
 extract the files just like the first format.

 I also attached a draft version of a patch which enabled me to update the
 plugin, zipped in the first format (no root folder).

 Inside `install_package()`, it checks if the destination folder is
 protected - and during plugin update, destination is the path to `wp-
 content/plugins`. Since that's protected, it rewrites the destination
 based on `$source` - the temporary folder - so it becomes `wp-
 content/plugins/my-plugin.tmp`.  During plugin update, there's an array of
 "hook_extra" passed to the function, and it contains the plugin attribute
 in the syntax: "my-plugin/my-plugin.php". So, if that's available, I get
 the plugin's top directory and use it instead of the temporary one in
 $source.

 Not the most elegant way to do it at the moment, but it works: I can now
 update the plugin and it will stay in the correct folder.

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


More information about the wp-trac mailing list