Make WordPress Core

Changes between Version 3 and Version 4 of Ticket #30945, comment 6


Ignore:
Timestamp:
01/08/2015 03:00:37 AM (10 years ago)
Author:
miyarakira
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #30945, comment 6

    v3 v4  
    33I also attached a draft version of a patch which enabled me to update the plugin, zipped in the first format (no root folder).
    44
    5 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 `basename( $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.
     5Inside `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.
    66
    77Not 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.