diff -r 7b1b88e27a20 -r 48c4eec2b7e6 wp/wp-admin/plugins.php
--- a/wp/wp-admin/plugins.php Thu Sep 29 08:06:27 2022 +0200
+++ b/wp/wp-admin/plugins.php Fri Sep 05 18:40:08 2025 +0200
@@ -40,6 +40,8 @@
wp_enqueue_script( 'updates' );
+WP_Plugin_Dependencies::initialize();
+
if ( $action ) {
switch ( $action ) {
@@ -339,15 +341,31 @@
?>
@@ -411,8 +429,9 @@
$delete_result = delete_plugins( $plugins );
- // Store the result in a cache rather than a URL param due to object type & length.
- set_transient( 'plugins_delete_result_' . $user_ID, $delete_result );
+ // Store the result in an option rather than a URL param due to object type & length.
+ // Cannot use transient/cache, as that could get flushed if any plugin flushes data on uninstall/delete.
+ update_option( 'plugins_delete_result_' . $user_ID, $delete_result, false );
wp_redirect( self_admin_url( "plugins.php?deleted=$plugins_to_delete&plugin_status=$status&paged=$page&s=$s" ) );
exit;
case 'clear-recent-list':
@@ -495,7 +514,7 @@
// Return early if all selected plugins already have auto-updates enabled or disabled.
// Must use non-strict comparison, so that array order is not treated as significant.
- if ( $new_auto_updates == $auto_updates ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
+ if ( $new_auto_updates == $auto_updates ) { // phpcs:ignore Universal.Operators.StrictComparisons.LooseEqual
wp_redirect( $redirect );
exit;
}
@@ -547,7 +566,7 @@
'' . __( 'The search for installed plugins will search for terms in their name, description, or author.' ) . ' ' . __( 'The search results will be updated as you type.' ) . '
' .
'' . sprintf(
/* translators: %s: WordPress Plugin Directory URL. */
- __( 'If you would like to see more plugins to choose from, click on the “Add New” button and you will be able to browse or search for additional plugins from the WordPress Plugin Directory. Plugins in the WordPress Plugin Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they’re free!' ),
+ __( 'If you would like to see more plugins to choose from, click on the “Add New Plugin” button and you will be able to browse or search for additional plugins from the WordPress Plugin Directory. Plugins in the WordPress Plugin Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they’re free!' ),
__( 'https://wordpress.org/plugins/' )
) . '
',
)
@@ -580,14 +599,14 @@
)
);
- $help_sidebar_autoupdates = '' . __( 'Learn more: Auto-updates documentation' ) . '
';
+ $help_sidebar_autoupdates = '' . __( 'Documentation on Auto-updates' ) . '
';
}
get_current_screen()->set_help_sidebar(
'' . __( 'For more information:' ) . '
' .
- '' . __( 'Documentation on Managing Plugins' ) . '
' .
+ '' . __( 'Documentation on Managing Plugins' ) . '
' .
$help_sidebar_autoupdates .
- '' . __( 'Support' ) . '
'
+ '' . __( 'Support forums' ) . '
'
);
get_current_screen()->set_screen_reader_content(
@@ -607,18 +626,29 @@
$invalid = validate_active_plugins();
if ( ! empty( $invalid ) ) {
foreach ( $invalid as $plugin_file => $error ) {
- echo '';
- printf(
+ $deactivated_message = sprintf(
/* translators: 1: Plugin file, 2: Error message. */
__( 'The plugin %1$s has been deactivated due to an error: %2$s' ),
'' . esc_html( $plugin_file ) . '',
esc_html( $error->get_error_message() )
);
- echo '
';
+ wp_admin_notice(
+ $deactivated_message,
+ array(
+ 'id' => 'message',
+ 'additional_classes' => array( 'error' ),
+ )
+ );
}
}
-if ( isset( $_GET['error'] ) ) :
+// Used by wp_admin_notice() updated notices.
+$updated_notice_args = array(
+ 'id' => 'message',
+ 'additional_classes' => array( 'updated' ),
+ 'dismissible' => true,
+);
+if ( isset( $_GET['error'] ) ) {
if ( isset( $_GET['main'] ) ) {
$errmsg = __( 'You cannot delete a plugin while it is active on the main site.' );
@@ -639,10 +669,6 @@
$errmsg = __( 'Plugin could not be activated because it triggered a fatal error.' );
}
- ?>
-
- 'message',
+ 'additional_classes' => array( 'error' ),
+ )
+ );
+
+} elseif ( isset( $_GET['deleted'] ) ) {
+ $delete_result = get_option( 'plugins_delete_result_' . $user_ID );
// Delete it once we're done.
- delete_transient( 'plugins_delete_result_' . $user_ID );
+ delete_option( 'plugins_delete_result_' . $user_ID );
- if ( is_wp_error( $delete_result ) ) :
- ?>
-
-
- get_error_message() )
- );
- ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ if ( is_wp_error( $delete_result ) ) {
+ $plugin_not_deleted_message = sprintf(
+ /* translators: %s: Error message. */
+ __( 'Plugin could not be deleted due to an error: %s' ),
+ esc_html( $delete_result->get_error_message() )
+ );
+ wp_admin_notice(
+ $plugin_not_deleted_message,
+ array(
+ 'id' => 'message',
+ 'additional_classes' => array( 'error' ),
+ 'dismissible' => true,
+ )
+ );
+ } else {
+ if ( 1 === (int) $_GET['deleted'] ) {
+ $plugins_deleted_message = __( 'The selected plugin has been deleted.' );
+ } else {
+ $plugins_deleted_message = __( 'The selected plugins have been deleted.' );
+ }
+ wp_admin_notice( $plugins_deleted_message, $updated_notice_args );
+ }
+} elseif ( isset( $_GET['activate'] ) ) {
+ wp_admin_notice( __( 'Plugin activated.' ), $updated_notice_args );
+} elseif ( isset( $_GET['activate-multi'] ) ) {
+ wp_admin_notice( __( 'Selected plugins activated.' ), $updated_notice_args );
+} elseif ( isset( $_GET['deactivate'] ) ) {
+ wp_admin_notice( __( 'Plugin deactivated.' ), $updated_notice_args );
+} elseif ( isset( $_GET['deactivate-multi'] ) ) {
+ wp_admin_notice( __( 'Selected plugins deactivated.' ), $updated_notice_args );
+} elseif ( 'update-selected' === $action ) {
+ wp_admin_notice( __( 'All selected plugins are up to date.' ), $updated_notice_args );
+} elseif ( isset( $_GET['resume'] ) ) {
+ wp_admin_notice( __( 'Plugin resumed.' ), $updated_notice_args );
+} elseif ( isset( $_GET['enabled-auto-update'] ) ) {
+ wp_admin_notice( __( 'Plugin will be auto-updated.' ), $updated_notice_args );
+} elseif ( isset( $_GET['disabled-auto-update'] ) ) {
+ wp_admin_notice( __( 'Plugin will no longer be auto-updated.' ), $updated_notice_args );
+} elseif ( isset( $_GET['enabled-auto-update-multi'] ) ) {
+ wp_admin_notice( __( 'Selected plugins will be auto-updated.' ), $updated_notice_args );
+} elseif ( isset( $_GET['disabled-auto-update-multi'] ) ) {
+ wp_admin_notice( __( 'Selected plugins will no longer be auto-updated.' ), $updated_notice_args );
+}
+?>
+
+