WordPress.org

Make WordPress Core

Opened 8 years ago

Last modified 5 months ago

#20437 new enhancement

WP Upgrader filter to allow plugins to upload to existing directory

Reported by: usermrpapa Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.3.1
Component: Upgrade/Install Keywords: needs-refresh reporter-feedback
Focuses: Cc:
PR Number:

Description

Our plugin for WP uses various elements of the WP upgrader class to manage plugins for our plugin. ;) This has worked great except when we went to extend it further and allow uploading of plugins through the WP Upgrader class much like you can with WP plugins.

The issue is that currently, the WP Upgrader class is coded to expect the upload destination to be empty - EXCEPT if the upload destination (the base directory) is one of these hard coded locations:

in_array( $destination, array(ABSPATH, WP_CONTENT_DIR, WP_PLUGIN_DIR, WP_CONTENT_DIR . '/themes') )

So since our plugin storage location is not one of those, it fails since there may already be some plugins there.

Sure would be nice if that array of locations that does not have to be empty (the important base dirs which allow dropping down a directory level)... a simple filter would accomplish this...

Hope its not too late in 4.3 for a simple filter...

Attachments (1)

upgrader_base_dirs_filter.patch (867 bytes) - added by usermrpapa 8 years ago.

Download all attachments as: .zip

Change History (4)

#1 @usermrpapa
8 years ago

  • Cc steve@… added

#2 @usermrpapa
7 years ago

errr. meant 3.4 but since RC guessing too late...

#3 @antpb
4 years ago

  • Component changed from Upload to Upgrade/Install
  • Keywords needs-refresh reporter-feedback added; has-patch removed

This looks to have been fixed for theme update failures in #22501

That ticket changes a lot of the logic behind protected deletion of files so this will need a refresh if it hasn't remedied the issue.

Note: See TracTickets for help on using tickets.