Plugins: Make delete plugin message less scary.

This adds a check if the plugin actually has an uninstall routine before saying that its data will be deleted too.

Props samful, joostdevalk, joyously, Chouby, SergeyBiryukov.
Fixes #50346.
Built from https://develop.svn.wordpress.org/trunk@48451


git-svn-id: http://core.svn.wordpress.org/trunk@48220 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-07-12 13:22:04 +00:00
parent c4543704e2
commit 9848b6b3e9
4 changed files with 16 additions and 2 deletions

View File

@ -942,6 +942,10 @@ class WP_Plugins_List_Table extends WP_List_Table {
$class .= ' paused';
}
if ( is_uninstallable_plugin( $plugin_file ) ) {
$class .= ' is-uninstallable';
}
printf(
'<tr class="%s" data-slug="%s" data-plugin="%s">',
esc_attr( $class ),

View File

@ -2138,11 +2138,21 @@
*/
$bulkActionForm.on( 'click', '[data-plugin] a.delete', function( event ) {
var $pluginRow = $( event.target ).parents( 'tr' ),
confirmMessage;
if ( $pluginRow.hasClass( 'is-uninstallable' ) ) {
confirmMessage = sprintf(
/* translators: %s: Plugin name. */
__( 'Are you sure you want to delete %s and its data?' ),
$pluginRow.find( '.plugin-title strong' ).text()
);
} else {
confirmMessage = sprintf(
/* translators: %s: Plugin name. */
__( 'Are you sure you want to delete %s?' ),
$pluginRow.find( '.plugin-title strong' ).text()
);
}
event.preventDefault();

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.5-beta1-48450';
$wp_version = '5.5-beta1-48451';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.