Make WordPress Core

Ticket #46573: 46573.diff

File 46573.diff, 6.3 KB (added by pento, 6 years ago)
  • Gruntfile.js

    diff --git a/Gruntfile.js b/Gruntfile.js
    index a27fc2b735..f40fa336cf 100644
    a b module.exports = function(grunt) { 
    263263                                        [ WORKING_DIR + 'wp-admin/js/tags-box.js' ]: [ './src/js/_enqueues/admin/tags-box.js' ],
    264264                                        [ WORKING_DIR + 'wp-admin/js/tags-suggest.js' ]: [ './src/js/_enqueues/admin/tags-suggest.js' ],
    265265                                        [ WORKING_DIR + 'wp-admin/js/tags.js' ]: [ './src/js/_enqueues/admin/tags.js' ],
     266                                        [ WORKING_DIR + 'wp-admin/js/site-health.js' ]: [ './src/js/_enqueues/admin/site-health.js' ],
    266267                                        [ WORKING_DIR + 'wp-admin/js/theme-plugin-editor.js' ]: [ './src/js/_enqueues/wp/theme-plugin-editor.js' ],
    267268                                        [ WORKING_DIR + 'wp-admin/js/theme.js' ]: [ './src/js/_enqueues/wp/theme.js' ],
    268269                                        [ WORKING_DIR + 'wp-admin/js/updates.js' ]: [ './src/js/_enqueues/wp/updates.js' ],
  • src/wp-admin/admin-ajax.php

    diff --git a/src/wp-admin/admin-ajax.php b/src/wp-admin/admin-ajax.php
    index 93c32393e0..e0194ceba8 100644
    a b $core_actions_post = array( 
    131131        'edit-theme-plugin-file',
    132132        'wp-privacy-export-personal-data',
    133133        'wp-privacy-erase-personal-data',
     134        'health-check-site-status-result',
     135        'health-check-dotorg-communication',
     136        'health-check-is-in-debug-mode',
     137        'health-check-background-updates',
     138        'health-check-loopback-requests',
    134139);
    135140
    136141// Deprecated
  • src/wp-admin/css/wp-admin.css

    diff --git a/src/wp-admin/css/wp-admin.css b/src/wp-admin/css/wp-admin.css
    index 14c10f9cd9..b475cf0aaf 100644
    a b  
    1212@import url(widgets.css);
    1313@import url(site-icon.css);
    1414@import url(l10n.css);
     15@import url(site-health.css);
  • src/wp-admin/includes/ajax-actions.php

    diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php
    index 474319e75c..cb39a2ee4f 100644
    a b function wp_ajax_wp_privacy_erase_personal_data() { 
    48584858
    48594859        wp_send_json_success( $response );
    48604860}
     4861
     4862/**
     4863 * Ajax handler for site health checks on server communication.
     4864 *
     4865 * @since 5.2.0
     4866 */
     4867function wp_ajax_health_check_dotorg_communication() {
     4868        check_ajax_referer( 'health-check-site-status' );
     4869
     4870        if ( ! current_user_can( 'install_plugins' ) ) {
     4871                wp_send_json_error();
     4872        }
     4873
     4874        if ( ! class_exists( 'WP_Site_Health' ) ) {
     4875                require_once( ABSPATH . 'wp-admin/includes/class-wp-site-health.php' );
     4876        }
     4877
     4878        $site_health = new WP_Site_Health();
     4879        wp_send_json_success( $site_health->get_test_dotorg_communication() );
     4880}
     4881
     4882/**
     4883 * Ajax handler for site health checks on debug mode.
     4884 *
     4885 * @since 5.2.0
     4886 */
     4887function wp_ajax_health_check_is_in_debug_mode() {
     4888        wp_verify_nonce( 'health-check-site-status' );
     4889
     4890        if ( ! current_user_can( 'install_plugins' ) ) {
     4891                wp_send_json_error();
     4892        }
     4893
     4894        if ( ! class_exists( 'WP_Site_Health' ) ) {
     4895                require_once( ABSPATH . 'wp-admin/includes/class-wp-site-health.php' );
     4896        }
     4897
     4898        $site_health = new WP_Site_Health();
     4899        wp_send_json_success( $site_health->get_test_is_in_debug_mode() );
     4900}
     4901
     4902/**
     4903 * Ajax handler for site health checks on background updates.
     4904 *
     4905 * @since 5.2.0
     4906 */
     4907function wp_ajax_health_check_background_updates() {
     4908        check_ajax_referer( 'health-check-site-status' );
     4909
     4910        if ( ! current_user_can( 'install_plugins' ) ) {
     4911                wp_send_json_error();
     4912        }
     4913
     4914        if ( ! class_exists( 'WP_Site_Health' ) ) {
     4915                require_once( ABSPATH . 'wp-admin/includes/class-wp-site-health.php' );
     4916        }
     4917
     4918        $site_health = new WP_Site_Health();
     4919        wp_send_json_success( $site_health->get_test_background_updates() );
     4920}
     4921
     4922
     4923/**
     4924 * Ajax handler for site health checks on loopback requests.
     4925 *
     4926 * @since 5.2.0
     4927 */
     4928function wp_ajax_health_check_loopback_requests() {
     4929        check_ajax_referer( 'health-check-site-status' );
     4930
     4931        if ( ! current_user_can( 'install_plugins' ) ) {
     4932                wp_send_json_error();
     4933        }
     4934
     4935        if ( ! class_exists( 'WP_Site_Health' ) ) {
     4936                require_once( ABSPATH . 'wp-admin/includes/class-wp-site-health.php' );
     4937        }
     4938
     4939        $site_health = new WP_Site_Health();
     4940        wp_send_json_success( $site_health->get_test_loopback_requests() );
     4941}
     4942
     4943/**
     4944 * Ajax handler for site health check to update the result status.
     4945 *
     4946 * @since 5.2.0
     4947 */
     4948function wp_ajax_health_check_site_status_result() {
     4949        check_ajax_referer( 'health-check-site-status-result' );
     4950
     4951        if ( ! current_user_can( 'install_plugins' ) ) {
     4952                wp_send_json_error();
     4953        }
     4954
     4955        set_transient( 'health-check-site-status-result', wp_json_encode( $_POST['counts'] ) );
     4956
     4957        wp_send_json_success();
     4958}
  • src/wp-admin/menu.php

    diff --git a/src/wp-admin/menu.php b/src/wp-admin/menu.php
    index f4490b7bf3..ca9357b89b 100644
    a b $menu[75] = array( __( 'Tools' ), 'edit_posts', 'tools.php', 
    263263        $submenu['tools.php'][5]  = array( __( 'Available Tools' ), 'edit_posts', 'tools.php' );
    264264        $submenu['tools.php'][10] = array( __( 'Import' ), 'import', 'import.php' );
    265265        $submenu['tools.php'][15] = array( __( 'Export' ), 'export', 'export.php' );
     266        $submenu['tools.php'][20] = array( __( 'Site Health' ), 'install_plugins', 'site-health.php' );
    266267if ( is_multisite() && ! is_main_site() ) {
    267268        $submenu['tools.php'][25] = array( __( 'Delete Site' ), 'delete_site', 'ms-delete-site.php' );
    268269}
  • src/wp-includes/script-loader.php

    diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php
    index a3ca60e75e..5bba581d8f 100644
    a b function wp_default_scripts( &$scripts ) { 
    16881688                        )
    16891689                );
    16901690
     1691                $scripts->add( 'site-health', "/wp-admin/js/site-health$suffix.js", array( 'jquery', 'wp-util', 'wp-a11y' ), false, 1 );
     1692
    16911693                $scripts->add( 'updates', "/wp-admin/js/updates$suffix.js", array( 'jquery', 'wp-util', 'wp-a11y' ), false, 1 );
    16921694                did_action( 'init' ) && $scripts->localize(
    16931695                        'updates',
    function wp_default_styles( &$styles ) { 
    19331935        $styles->add( 'site-icon', "/wp-admin/css/site-icon$suffix.css" );
    19341936        $styles->add( 'l10n', "/wp-admin/css/l10n$suffix.css" );
    19351937        $styles->add( 'code-editor', "/wp-admin/css/code-editor$suffix.css", array( 'wp-codemirror' ) );
     1938        $styles->add( 'site-health', "/wp-admin/css/site-health$suffix.css" );
    19361939
    19371940        $styles->add( 'wp-admin', false, array( 'dashicons', 'common', 'forms', 'admin-menu', 'dashboard', 'list-tables', 'edit', 'revisions', 'media', 'themes', 'about', 'nav-menus', 'widgets', 'site-icon', 'l10n' ) );
    19381941