Site Health: Add auto-update information to for plugins and themes.

New filters:

* `plugin_auto_update_debug_str`
* `theme_auto_update_debug_str`

Fixes #50663.
Props pbiron, audrasjb, davidbaumwald.

Built from https://develop.svn.wordpress.org/trunk@48546


git-svn-id: http://core.svn.wordpress.org/trunk@48308 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
whyisjake 2020-07-21 16:54:02 +00:00
parent 548df4e3e6
commit 32f791da49
2 changed files with 59 additions and 6 deletions

View File

@ -907,15 +907,16 @@ class WP_Debug_Data {
$plugin_updates = get_plugin_updates();
$auto_updates = array();
$auto_updates_enabled = wp_is_auto_update_enabled_for_type( 'plugin' );
$auto_updates_enabled_str = __( 'Auto-updates enabled' );
$auto_updates_disabled_str = __( 'Auto-updates disabled' );
$auto_updates_enabled = wp_is_auto_update_enabled_for_type( 'plugin' );
if ( $auto_updates_enabled ) {
$auto_updates = (array) get_site_option( 'auto_update_plugins', array() );
}
foreach ( $plugins as $plugin_path => $plugin ) {
$auto_updates_enabled_str = __( 'Auto-updates enabled' );
$auto_updates_disabled_str = __( 'Auto-updates disabled' );
$plugin_part = ( is_plugin_active( $plugin_path ) ) ? 'wp-plugins-active' : 'wp-plugins-inactive';
$plugin_version = $plugin['Version'];
@ -950,9 +951,28 @@ class WP_Debug_Data {
if ( $auto_updates_enabled ) {
if ( in_array( $plugin_path, $auto_updates, true ) ) {
$enabled = true;
/**
* Filters the text string of the auto-updates setting for each plugin in the Site Health debug data.
*
* @since 5.5.0
*
* @param string $auto_updates_enabled_str The string output for the auto-updates column.
* @param array $plugin An array of plugin data.
* @param bool $enabled True if auto-updates are enabled for this item,
* false otherwise.
*/
$auto_updates_enabled_str = apply_filters( 'plugin_auto_update_debug_str', $auto_updates_enabled_str, $plugin, $enabled );
$plugin_version_string .= ' | ' . $auto_updates_enabled_str;
$plugin_version_string_debug .= ', ' . $auto_updates_enabled_str;
} else {
$enabled = false;
/** This filter is documented in wp-admin/includes/class-wp-debug-data.php */
$auto_updates_disabled_str = apply_filters( 'plugin_auto_update_debug_str', $auto_updates_disabled_str, $plugin, $enabled );
$plugin_version_string .= ' | ' . $auto_updates_disabled_str;
$plugin_version_string_debug .= ', ' . $auto_updates_disabled_str;
}
@ -1054,10 +1074,30 @@ class WP_Debug_Data {
);
if ( $auto_updates_enabled ) {
if ( in_array( $active_theme->stylesheet, $auto_updates, true ) ) {
$theme_auto_update_string = __( 'Enabled' );
$auto_updates_enabled_str = __( 'Enabled' );
$enabled = true;
/**
* Filters the text string of the auto-updates setting for each theme in the Site Health debug data.
*
* @since 5.5.0
*
* @param string $auto_updates_enabled_str The string output for the auto-updates column.
* @param object $theme An object of theme data.
* @param bool $enabled True if auto-updates are enabled for this item,
* false otherwise.
*/
$auto_updates_enabled_str = apply_filters( 'theme_auto_update_debug_str', $auto_updates_enabled_str, $active_theme, $enabled );
} else {
$theme_auto_update_string = __( 'Disabled' );
$auto_updates_disabled_str = __( 'Disabled' );
$enabled = false;
/** This filter is documented in wp-admin/includes/class-wp-debug-data.php */
$auto_updates_disabled_str = apply_filters( 'theme_auto_update_debug_str', $auto_updates_disabled_str, $active_theme, $enabled );
}
$theme_auto_update_string = $enabled ? $auto_updates_enabled_str : $auto_updates_disabled_str;
$info['wp-active-theme']['fields']['auto_update'] = array(
'label' => __( 'Auto-update' ),
@ -1139,6 +1179,9 @@ class WP_Debug_Data {
continue;
}
$auto_updates_enabled_str = __( 'Auto-updates enabled' );
$auto_updates_disabled_str = __( 'Auto-updates disabled' );
$theme_version = $theme->version;
$theme_author = $theme->author;
@ -1174,9 +1217,19 @@ class WP_Debug_Data {
if ( $auto_updates_enabled ) {
if ( in_array( $theme_slug, $auto_updates, true ) ) {
$enabled = true;
/** This filter is documented in wp-admin/includes/class-wp-debug-data.php */
$auto_updates_enabled_str = apply_filters( 'theme_auto_update_debug_str', $auto_updates_enabled_str, $theme, $enabled );
$theme_version_string .= ' | ' . $auto_updates_enabled_str;
$theme_version_string_debug .= ',' . $auto_updates_enabled_str;
} else {
$enabled = false;
/** This filter is documented in wp-admin/includes/class-wp-debug-data.php */
$auto_updates_disabled_str = apply_filters( 'theme_auto_update_debug_str', $auto_updates_disabled_str, $theme, $enabled );
$theme_version_string .= ' | ' . $auto_updates_disabled_str;
$theme_version_string_debug .= ', ' . $auto_updates_disabled_str;
}

View File

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