Make WordPress Core

Ticket #49151: 49151.diff

File 49151.diff, 4.3 KB (added by audrasjb, 3 years ago)

Site Health: Show a warning for plugins and themes that have not received updates in a long time.

  • src/wp-admin/includes/class-wp-debug-data.php

    diff --git a/src/wp-admin/includes/class-wp-debug-data.php b/src/wp-admin/includes/class-wp-debug-data.php
    index 7e21785cce..251da47ad7 100644
    a b class WP_Debug_Data { 
    873873                        'private' => true,
    874874                );
    875875
     876                include_once ABSPATH . 'wp-admin/includes/plugin-install.php'; // For plugins_api().
     877
    876878                // List must use plugins if there are any.
    877879                $mu_plugins = get_mu_plugins();
    878880
    class WP_Debug_Data { 
    880882                        $plugin_version = $plugin['Version'];
    881883                        $plugin_author  = $plugin['Author'];
    882884
     885                        $plugin_slug                 = explode( '/', $plugin_path );
     886                        $plugin_info                 = plugins_api(
     887                                'plugin_information',
     888                                array(
     889                                        'slug'   => $plugin_slug[0],
     890                                        'fields' => array(
     891                                                'last_updated',
     892                                        ),
     893                                )
     894                        );
    883895                        $plugin_version_string       = __( 'No version or author information is available.' );
    884896                        $plugin_version_string_debug = 'author: (undefined), version: (undefined)';
    885897
    class WP_Debug_Data { 
    10091021                                $plugin_version_string_debug .= ', ' . $auto_updates_string;
    10101022                        }
    10111023
     1024                        if ( isset( $plugin_info->last_updated ) ) {
     1025                                /* translators: %s: Plugin last released time. */
     1026                                $plugin_version_string       .= sprintf( __( ' | Last Plugin release: %s ago' ), human_time_diff( strtotime( $plugin_info->last_updated ), current_time( 'timestamp' ) ) );
     1027                                $plugin_version_string_debug .= sprintf( __( ', last plugin release: %s ago' ), human_time_diff( strtotime( $plugin_info->last_updated ), current_time( 'timestamp' ) ) );
     1028                        }
     1029
    10121030                        $info[ $plugin_part ]['fields'][ sanitize_text_field( $plugin['Name'] ) ] = array(
    10131031                                'label' => $plugin['Name'],
    10141032                                'value' => $plugin_version_string,
    class WP_Debug_Data { 
    10161034                        );
    10171035                }
    10181036
     1037                include_once ABSPATH . 'wp-admin/includes/theme.php'; // For themes_api().
     1038
    10191039                // Populate the section for the currently active theme.
    10201040                global $_wp_theme_features;
    10211041                $theme_features = array();
    class WP_Debug_Data { 
    10391059                        $auto_updates = (array) get_site_option( 'auto_update_themes', array() );
    10401060                }
    10411061
     1062                $active_theme_info = themes_api(
     1063                        'theme_information',
     1064                        array(
     1065                                'slug'   => $active_theme->template,
     1066                                'fields' => 'last_updated',
     1067                        )
     1068                );
     1069
    10421070                if ( array_key_exists( $active_theme->stylesheet, $theme_updates ) ) {
    10431071                        $theme_update_new_version = $theme_updates[ $active_theme->stylesheet ]->update['new_version'];
    10441072
    class WP_Debug_Data { 
    11471175                        );
    11481176                }
    11491177
     1178                if ( isset( $active_theme->last_updated ) ) {
     1179                        $info['wp-active-theme']['fields']['last_release'] = array(
     1180                                'label' => __( 'Last Theme Release' ),
     1181                                'value' => sprintf( __( '%s ago' ), human_time_diff( strtotime( $active_theme_info->last_updated ), current_time( 'timestamp' ) ) ),
     1182                                'debug' => sprintf( __( '%s ago' ), human_time_diff( strtotime( $active_theme_info->last_updated ), current_time( 'timestamp' ) ) ),
     1183                        );
     1184                }
     1185
    11501186                $parent_theme = $active_theme->parent();
    11511187
    11521188                if ( $parent_theme ) {
    class WP_Debug_Data { 
    12591295                        $theme_version_string       = __( 'No version or author information is available.' );
    12601296                        $theme_version_string_debug = 'undefined';
    12611297
     1298                        $theme_info = themes_api(
     1299                                'theme_information',
     1300                                array(
     1301                                        'slug'   => $theme_slug,
     1302                                        'fields' => 'last_updated',
     1303                                )
     1304                        );
     1305
    12621306                        if ( ! empty( $theme_version ) && ! empty( $theme_author ) ) {
    12631307                                /* translators: 1: Theme version number. 2: Theme author name. */
    12641308                                $theme_version_string       = sprintf( __( 'Version %1$s by %2$s' ), $theme_version, $theme_author );
    class WP_Debug_Data { 
    13301374                                $theme_version_string_debug .= ',' . $auto_updates_string;
    13311375                        }
    13321376
     1377                        if ( isset( $theme_info->last_updated ) ) {
     1378                                /* translators: %s: Theme last released time. */
     1379                                $theme_version_string       .= sprintf( __( ' | Last Theme release: %s ago' ), human_time_diff( strtotime( $theme_info->last_updated ), current_time( 'timestamp' ) ) );
     1380                                $theme_version_string_debug .= sprintf( __( ', last theme release: %s ago' ), human_time_diff( strtotime( $theme_info->last_updated ), current_time( 'timestamp' ) ) );
     1381                        }
     1382
    13331383                        $info['wp-themes-inactive']['fields'][ sanitize_text_field( $theme->name ) ] = array(
    13341384                                'label' => sprintf(
    13351385                                        /* translators: 1: Theme name. 2: Theme slug. */