From 96b409c7f134b6f40cd2e164a78a41339603b028 Mon Sep 17 00:00:00 2001 From: Jake Spurlock Date: Fri, 31 Jul 2020 17:19:34 +0000 Subject: [PATCH] Upgrade/Install: Ensure the proper count of plugins that have auto-update enabled. As certain plugins may not support updates, this count needs to accurately reflect that in the navbar. Fixes 50808. Props knutsp, audrasjb, pbiron, dd32, apedog, afragen, chriscct7, garyc40, whyisjake, SergeyBiryukov. git-svn-id: https://develop.svn.wordpress.org/trunk@48703 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/class-wp-plugins-list-table.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/wp-admin/includes/class-wp-plugins-list-table.php b/src/wp-admin/includes/class-wp-plugins-list-table.php index eb33550d88..ff7a90b222 100644 --- a/src/wp-admin/includes/class-wp-plugins-list-table.php +++ b/src/wp-admin/includes/class-wp-plugins-list-table.php @@ -279,10 +279,15 @@ class WP_Plugins_List_Table extends WP_List_Table { } if ( $this->show_autoupdates ) { - if ( in_array( $plugin_file, $auto_updates, true ) ) { - $plugins['auto-update-enabled'][ $plugin_file ] = $plugins['all'][ $plugin_file ]; + $enabled = in_array( $plugin_file, $auto_updates, true ) && $plugin_data['update-supported']; + if ( isset( $plugin_data['auto-update-forced'] ) ) { + $enabled = (bool) $plugin_data['auto-update-forced']; + } + + if ( $enabled ) { + $plugins['auto-update-enabled'][ $plugin_file ] = $plugin_data; } else { - $plugins['auto-update-disabled'][ $plugin_file ] = $plugins['all'][ $plugin_file ]; + $plugins['auto-update-disabled'][ $plugin_file ] = $plugin_data; } } }