WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 5 years ago

#35145 closed defect (bug) (wontfix)

Plugins: introduce a check for activated plugins when deleting plugins in the same directory

Reported by: afercia Owned by: swissspidy
Milestone: Priority: normal
Severity: normal Version: 4.4
Component: Plugins Keywords: has-patch needs-testing 2nd-opinion
Focuses: ui, multisite Cc:

Description

Noticed while investigating on #34439

Sometimes, plugin authors bundle multiple plugins in the same directory. They shouldn't to this in the first place, but they do.

When deleting one of the "same directory" plugins, WordPress handles this displaying a warning with a message that correctly lists all the plugins that are going to be deleted:

https://cldup.com/t0T_q6tyAw.png

By the way, if one of these plugin is activated, there's no warning and users can actually delete an activated plugin. This should definitely be avoided.

https://cldup.com/2_jD5dr1HI.png

Also, needs to check what happens on multisite installations :)

cc @swissspidy

Attachments (2)

35145.diff (2.7 KB) - added by swissspidy 6 years ago.
35145.2.diff (6.7 KB) - added by swissspidy 6 years ago.

Download all attachments as: .zip

Change History (10)

@swissspidy
6 years ago

#1 @swissspidy
6 years ago

  • Keywords has-patch needs-testing added; needs-patch removed

With 35145.diff, no "Delete" link is added when there's at least 1 active plugin in the same directory (or "bundle").

There's also a check for multisite, just needs some testing there and for bulk edit as well.

Screenshot:

Plugin A, B and C are all in the same folder under wp-content/plugins/bundle/ and A is active. The others can't be selected for deletion.

https://cldup.com/imDfwi3Vjw.png

#2 @afercia
6 years ago

  • Owner set to swissspidy
  • Status changed from new to assigned

@swissspidy
6 years ago

#3 @swissspidy
6 years ago

35145.2.diff is a new patch that prevents bulk deletion of plugins when there's at least 1 active plugin the same folder.

For this, I moved the logic into a new _is_plugin_bundle_active() function.

Patch in action:

https://cldup.com/SXi-LwWcu9.png

#4 @swissspidy
6 years ago

  • Keywords 2nd-opinion added

Bundled plugins aren't that common, not sure if this is worth fixing.

#5 @dd32
6 years ago

Bundled plugins aren't that common, not sure if this is worth fixing.

I tend to agree. I'm not sure if it's already the case, but on the 'Are you sure?' page maybe it could be listed there if they're active instead? Just append an (Active) to it or something? (if someone really feels that this needs "fixing")

#6 @swissspidy
6 years ago

On the 'Are you sure?' page maybe it could be listed there if they're active instead? Just append an (Active) to it or something? (if someone really feels that this needs "fixing")

When someone ignores that hint and still deletes the plugin, he'll still get the same error message. With the current patch we avoid getting into this trouble.

#7 @swissspidy
6 years ago

  • Milestone changed from 4.5 to Future Release

#8 @swissspidy
5 years ago

  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from assigned to closed

Now with Shiny Updates this is more of a different issue and I don't think we should put too much effort into it.

Note: See TracTickets for help on using tickets.