WordPress.org

Make WordPress Core

Opened 8 months ago

Last modified 7 months ago

#22287 new defect (bug)

Plugin in another plugin folder causes Activate link to be wrong on Download

Reported by: joehoyle Owned by:
Priority: normal Milestone: Awaiting Review
Component: Upgrade/Install Version: 3.4
Severity: normal Keywords:
Cc:

Description

I am not sure if shipping a plugin within another plugin is officially supported, but there is an inconsistency between the activate links in the Manage Plugins page, and the Activate Plugin on the Plugin Downloaded success page.

This is because on the Manage Plugins page, the get_plugins() is going to scan the plugins dir and all dirs within it, however, on the Upgrade page, it calls get_plugins() specifying the plugin dir as the base (see https://github.com/WordPress/WordPress/blob/master/wp-admin/includes/class-wp-upgrader.php#L579)

That will cause the "embedded" plugin to be picked up, and if it's alphabetically above the main plugin file (presumably) see code comment " Assume the requested plugin is the first in the list"

Attachments (1)

class-wp-upgrader.php.diff (1.0 KB) - added by joehoyle 8 months ago.

Download all attachments as: .zip

Change History (8)

comment:1 joehoyle8 months ago

Perhaps this could be fixed by adding a second param "$search_directories" to get_plugins() which is set to false in the Upgrader step?

I am happy to write a patch with some direction on this.

comment:2 joehoyle8 months ago

I added a patch that will order the array from get_plugins( $plugin ) with files not in directories to the top.

comment:3 dd328 months ago

  • Component changed from Plugins to Upgrade/Install

Duplicate of #21954, not closing as the other ticket doesn't have a patch.
I like the patch, and it's the preferred solution I suggested in that ticket too.

comment:4 joehoyle8 months ago

Yes, seems we had the same idea on both accounts, who do I need to bug to try get this committed?

comment:5 SergeyBiryukov8 months ago

#21954 was marked as a duplicate.

comment:6 SergeyBiryukov8 months ago

From #21954:

This issue also applies when deleting the plugin as it lists both plugins on the confirmation page.

comment:7 SergeyBiryukov7 months ago

  • Version changed from trunk to 3.4
Note: See TracTickets for help on using tickets.