Make WordPress Core

Changeset 48546


Ignore:
Timestamp:
07/21/2020 04:52:47 PM (6 years ago)
Author:
whyisjake
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-debug-data.php

    r48544 r48546  
    908908                $auto_updates   = array();
    909909
    910                 $auto_updates_enabled      = wp_is_auto_update_enabled_for_type( 'plugin' );
    911                 $auto_updates_enabled_str  = __( 'Auto-updates enabled' );
    912                 $auto_updates_disabled_str = __( 'Auto-updates disabled' );
     910                $auto_updates_enabled = wp_is_auto_update_enabled_for_type( 'plugin' );
    913911
    914912                if ( $auto_updates_enabled ) {
    … …  
    917915
    918916                foreach ( $plugins as $plugin_path => $plugin ) {
     917                        $auto_updates_enabled_str  = __( 'Auto-updates enabled' );
     918                        $auto_updates_disabled_str = __( 'Auto-updates disabled' );
     919
    919920                        $plugin_part = ( is_plugin_active( $plugin_path ) ) ? 'wp-plugins-active' : 'wp-plugins-inactive';
    920921
    … …  
    951952                        if ( $auto_updates_enabled ) {
    952953                                if ( in_array( $plugin_path, $auto_updates, true ) ) {
     954                                        $enabled = true;
     955
     956                                        /**
     957                                         * Filters the text string of the auto-updates setting for each plugin in the Site Health debug data.
     958                                         *
     959                                         * @since 5.5.0
     960                                         *
     961                                         * @param string $auto_updates_enabled_str The string output for the auto-updates column.
     962                                         * @param array  $plugin                   An array of plugin data.
     963                                         * @param bool   $enabled                  True if auto-updates are enabled for this item,
     964                                         *                                         false otherwise.
     965                                         */
     966                                        $auto_updates_enabled_str = apply_filters( 'plugin_auto_update_debug_str', $auto_updates_enabled_str, $plugin, $enabled );
     967
    953968                                        $plugin_version_string       .= ' | ' . $auto_updates_enabled_str;
    954969                                        $plugin_version_string_debug .= ', ' . $auto_updates_enabled_str;
    955970                                } else {
     971                                        $enabled = false;
     972
     973                                        /** This filter is documented in wp-admin/includes/class-wp-debug-data.php */
     974                                        $auto_updates_disabled_str = apply_filters( 'plugin_auto_update_debug_str', $auto_updates_disabled_str, $plugin, $enabled );
     975
    956976                                        $plugin_version_string       .= ' | ' . $auto_updates_disabled_str;
    957977                                        $plugin_version_string_debug .= ', ' . $auto_updates_disabled_str;
    … …  
    10551075                if ( $auto_updates_enabled ) {
    10561076                        if ( in_array( $active_theme->stylesheet, $auto_updates, true ) ) {
    1057                                 $theme_auto_update_string = __( 'Enabled' );
     1077                                $auto_updates_enabled_str = __( 'Enabled' );
     1078                                $enabled                  = true;
     1079
     1080                                /**
     1081                                 * Filters the text string of the auto-updates setting for each theme in the Site Health debug data.
     1082                                 *
     1083                                 * @since 5.5.0
     1084                                 *
     1085                                 * @param string $auto_updates_enabled_str The string output for the auto-updates column.
     1086                                 * @param object $theme                    An object of theme data.
     1087                                 * @param bool   $enabled                  True if auto-updates are enabled for this item,
     1088                                 *                                         false otherwise.
     1089                                 */
     1090                                $auto_updates_enabled_str = apply_filters( 'theme_auto_update_debug_str', $auto_updates_enabled_str, $active_theme, $enabled );
     1091
    10581092                        } else {
    1059                                 $theme_auto_update_string = __( 'Disabled' );
    1060                         }
     1093                                $auto_updates_disabled_str = __( 'Disabled' );
     1094                                $enabled                   = false;
     1095
     1096                                /** This filter is documented in wp-admin/includes/class-wp-debug-data.php */
     1097                                $auto_updates_disabled_str = apply_filters( 'theme_auto_update_debug_str', $auto_updates_disabled_str, $active_theme, $enabled );
     1098
     1099                        }
     1100                        $theme_auto_update_string = $enabled ? $auto_updates_enabled_str : $auto_updates_disabled_str;
    10611101
    10621102                        $info['wp-active-theme']['fields']['auto_update'] = array(
    … …  
    11391179                                continue;
    11401180                        }
     1181
     1182                        $auto_updates_enabled_str  = __( 'Auto-updates enabled' );
     1183                        $auto_updates_disabled_str = __( 'Auto-updates disabled' );
    11411184
    11421185                        $theme_version = $theme->version;
    … …  
    11751218                        if ( $auto_updates_enabled ) {
    11761219                                if ( in_array( $theme_slug, $auto_updates, true ) ) {
     1220                                        $enabled = true;
     1221
     1222                                        /** This filter is documented in wp-admin/includes/class-wp-debug-data.php */
     1223                                        $auto_updates_enabled_str = apply_filters( 'theme_auto_update_debug_str', $auto_updates_enabled_str, $theme, $enabled );
     1224
    11771225                                        $theme_version_string       .= ' | ' . $auto_updates_enabled_str;
    11781226                                        $theme_version_string_debug .= ',' . $auto_updates_enabled_str;
    11791227                                } else {
     1228                                        $enabled = false;
     1229
     1230                                        /** This filter is documented in wp-admin/includes/class-wp-debug-data.php */
     1231                                        $auto_updates_disabled_str = apply_filters( 'theme_auto_update_debug_str', $auto_updates_disabled_str, $theme, $enabled );
     1232
    11801233                                        $theme_version_string       .= ' | ' . $auto_updates_disabled_str;
    11811234                                        $theme_version_string_debug .= ', ' . $auto_updates_disabled_str;
Note: See TracChangeset for help on using the changeset viewer.