WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 5 years ago

#11850 closed enhancement (fixed)

Add plugin uninstaller notification text

Reported by: cyberhobo Owned by: nacin
Milestone: 3.0 Priority: normal
Severity: normal Version:
Component: Plugins Keywords: has-patch tested commit
Focuses: Cc:

Description

I'd like to see some indication in the plugin delete interface that a plugin has an uninstaller, and so will probably delete its data.

This is similar to issue #8783, but instead of proposing any new functionality, I just want to add some display information. I also have a patch.

The scenario that concerns me is this: a user has a plugin zip and wants to upgrade a plugin. They're not FTP savvy, so they try to use the upload interface, and get the "Destination folder already exists" message. So, they go back to the plugin listing and click "Delete" by the current plugin. It warns them that the files will be deleted, but this happens with automatic upgrades anyway, so it doesn't sound that scary. They click "Yes, delete these files", and their data is gone too...

Attachments (3)

test_uninstall_hook.php (473 bytes) - added by cyberhobo 6 years ago.
A test plugin that registers an uninstall hook.
plugins.diff (2.3 KB) - added by cyberhobo 5 years ago.
Patch freshened for r13230.
11850.diff (786 bytes) - added by scribu 5 years ago.
replace repetitive expression

Download all attachments as: .zip

Change History (22)

comment:1 @sc0ttkclark6 years ago

I concur with this! +1

comment:2 @scribu6 years ago

  • Milestone changed from Unassigned to 3.0

+1 on this.

I would replace

will also uninstall its data

with

will also delete its data

Also, I think we should open a new ticket for letting users upgrade plugins using the admin interface.

comment:3 @cyberhobo6 years ago

  • Cc cyberhobo@… added

comment:4 @scribu6 years ago

The patch works. However, is_uninstallable_plugin() only works for plugins that have an uninstall.php file.

It would be good if it detected if any callbacks are registered with register_uninstall_hook().

comment:5 @scribu6 years ago

PS: Try to make patches relative to the wp root directory, not a subdirectory.

svn diff wp-admin/plugins.php

This saves a step for testers and commiters.

@cyberhobo6 years ago

A test plugin that registers an uninstall hook.

comment:6 @cyberhobo6 years ago

Thanks for the tip, I've updated my patch.

I can't confirm your statement about is_uninstallable_plugin(), though. The attached plugin registers an uninstall hook. I found that if the plugin is never activated, is_uninstallable_plugin() returns false for it, and the hook is not run on deletion. After it is activated and deactivated, is_uninstallable_plugin() returns true for it and the hook is executed on deletion.

Is that a bug for a separate ticket?

comment:7 @scribu6 years ago

  • Keywords tested added; dev-feedback needs-testing removed

You're right. I hadn't activated the plugin.

One last thing: I think it would be good to make the notice more well... noticeable.

I was thinking of putting that text in ( ).

comment:8 @cyberhobo6 years ago

I wondered about that too - it's hard to compete with both STRONG and EM text already on the line. I think another STRONG doesn't hurt too much though. Updating the patch with:

'<strong>%s</strong> by <em>%s</em> (will also <strong>delete its data</strong>)'

comment:9 @scribu6 years ago

  • Keywords commit added

comment:11 @scribu5 years ago

  • Keywords needs-patch added; has-patch tested commit removed

Patch got stale (probably due to MU merge).

@cyberhobo5 years ago

Patch freshened for r13230.

comment:12 @cyberhobo5 years ago

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

Works for me.

comment:13 @scribu5 years ago

  • Keywords tested added; needs-testing removed

Also works here.

comment:14 @scribu5 years ago

  • Keywords commit added

comment:15 @nacin5 years ago

  • Owner changed from westi to nacin
  • Status changed from new to reviewing

comment:16 @nacin5 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

(In [13470]) When deleting plugins, check for uninstall hooks and warn of data deletion. Props cyberhobo. Pluralize some string(s). fixes #11850

comment:17 @nacin5 years ago

This looked really good. I adjusted some of the other strings as well and got rid of the Delete Plugin(s)-type strings by adding some pluralization checks. (And poked fun at that in the changeset message.)

@scribu5 years ago

replace repetitive expression

comment:18 @scribu5 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Cool :)

Related to strings, this sounds off:

'Deleting the selected plugins will remove the following plugins and its files:'

How about:

'You are about to remove the following plugins:'

See 11850.diff

comment:19 @nacin5 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [13477]) Clean up repetitive string. fixes #11850, props scribu

Note: See TracTickets for help on using tickets.