Network Admin: Show a warning when deleting non-network-only plugins, as they may be activated on subsites. fixes #15709.

git-svn-id: http://svn.automattic.com/wordpress/trunk@17036 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-12-17 23:21:15 +00:00
parent 6ce74f9c0a
commit c4be6fcbe1
1 changed files with 8 additions and 0 deletions

View File

@ -217,12 +217,15 @@ if ( $action ) {
<div class="wrap"> <div class="wrap">
<?php <?php
$files_to_delete = $plugin_info = array(); $files_to_delete = $plugin_info = array();
$have_non_network_plugins = false;
foreach ( (array) $plugins as $plugin ) { foreach ( (array) $plugins as $plugin ) {
if ( '.' == dirname($plugin) ) { if ( '.' == dirname($plugin) ) {
$files_to_delete[] = WP_PLUGIN_DIR . '/' . $plugin; $files_to_delete[] = WP_PLUGIN_DIR . '/' . $plugin;
if( $data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin) ) { if( $data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin) ) {
$plugin_info[ $plugin ] = $data; $plugin_info[ $plugin ] = $data;
$plugin_info[ $plugin ]['is_uninstallable'] = is_uninstallable_plugin( $plugin ); $plugin_info[ $plugin ]['is_uninstallable'] = is_uninstallable_plugin( $plugin );
if ( ! $plugin_info[ $plugin ]['Network'] )
$have_non_network_plugins = true;
} }
} else { } else {
// Locate all the files in that folder // Locate all the files in that folder
@ -235,6 +238,8 @@ if ( $action ) {
foreach( $plugins['folder'] as $plugin_file => $data ) { foreach( $plugins['folder'] as $plugin_file => $data ) {
$plugin_info[ $plugin_file ] = _get_plugin_data_markup_translate( $plugin_file, $data ); $plugin_info[ $plugin_file ] = _get_plugin_data_markup_translate( $plugin_file, $data );
$plugin_info[ $plugin_file ]['is_uninstallable'] = is_uninstallable_plugin( $plugin ); $plugin_info[ $plugin_file ]['is_uninstallable'] = is_uninstallable_plugin( $plugin );
if ( ! $plugin_info[ $plugin_file ]['Network'] )
$have_non_network_plugins = true;
} }
} }
} }
@ -243,6 +248,9 @@ if ( $action ) {
$plugins_to_delete = count( $plugin_info ); $plugins_to_delete = count( $plugin_info );
echo '<h2>' . _n( 'Delete Plugin', 'Delete Plugins', $plugins_to_delete ) . '</h2>'; echo '<h2>' . _n( 'Delete Plugin', 'Delete Plugins', $plugins_to_delete ) . '</h2>';
?> ?>
<?php if ( $have_non_network_plugins && is_network_admin() ) : ?>
<div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php echo _n( 'This plugin may be active on other sites in the network.', 'These plugins may be active on other sites in the network.', $plugins_to_delete ); ?></p></div>
<?php endif; ?>
<p><?php echo _n( 'You are about to remove the following plugin:', 'You are about to remove the following plugins:', $plugins_to_delete ); ?></p> <p><?php echo _n( 'You are about to remove the following plugin:', 'You are about to remove the following plugins:', $plugins_to_delete ); ?></p>
<ul class="ul-disc"> <ul class="ul-disc">
<?php <?php