<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[45156] trunk/src/wp-admin: Site health: Fix gathering the site data twice on non-English locales.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/45156">45156</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/45156","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>azaozz</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2019-04-10 05:06:54 +0000 (Wed, 10 Apr 2019)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Site health: Fix gathering the site data twice on non-English locales. Introduces two sets of data:
- More verbose set used to generate the admin page.
- More concise set that is copied when clicking the "Copy the site info" button intended mostly for support and developers.
Props xkon, azaozz.
Fixes <a href="https://core.trac.wordpress.org/ticket/46726">#46726</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminincludesclasswpdebugdataphp">trunk/src/wp-admin/includes/class-wp-debug-data.php</a></li>
<li><a href="#trunksrcwpadminsitehealthinfophp">trunk/src/wp-admin/site-health-info.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminincludesclasswpdebugdataphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/class-wp-debug-data.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/class-wp-debug-data.php 2019-04-09 15:23:20 UTC (rev 45155)
+++ trunk/src/wp-admin/includes/class-wp-debug-data.php 2019-04-10 05:06:54 UTC (rev 45156)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -30,18 +30,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $locale Optional. An ISO formatted language code to provide debug translations in. Default null.
</span><span class="cx" style="display: block; padding: 0 10px"> * @return array The debug data for the site.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- static function debug_data( $locale = null ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ static function debug_data() {
</ins><span class="cx" style="display: block; padding: 0 10px"> global $wpdb;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! empty( $locale ) ) {
- // Change the language used for translations
- $original_locale = get_user_locale();
- $switched_locale = switch_to_locale( $locale );
- }
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $upload_dir = wp_get_upload_dir();
- $core_current_version = get_bloginfo( 'version' );
- $core_updates = get_core_updates();
- $core_update_needed = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Save few function calls.
+ $locale = get_user_locale();
+ $upload_dir = wp_get_upload_dir();
+ $permalink_structure = get_option( 'permalink_structure' );
+ $is_ssl = is_ssl();
+ $users_can_register = get_option( 'users_can_register' );
+ $is_multisite = is_multisite();
+ $core_version = get_bloginfo( 'version' );
+ $core_updates = get_core_updates();
+ $core_update_needed = '';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $core_updates as $core => $update ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'upgrade' === $update->response ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -53,189 +54,273 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Set up the array that holds all debug information.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $info = array(
- 'wp-core' => array(
- 'label' => __( 'WordPress' ),
- 'fields' => array(
- 'version' => array(
- 'label' => __( 'Version' ),
- 'value' => $core_current_version . $core_update_needed,
- ),
- 'language' => array(
- 'label' => __( 'Language' ),
- 'value' => ( ! empty( $locale ) ? $original_locale : get_user_locale() ),
- ),
- 'home_url' => array(
- 'label' => __( 'Home URL' ),
- 'value' => get_bloginfo( 'url' ),
- 'private' => true,
- ),
- 'site_url' => array(
- 'label' => __( 'Site URL' ),
- 'value' => get_bloginfo( 'wpurl' ),
- 'private' => true,
- ),
- 'permalink' => array(
- 'label' => __( 'Permalink structure' ),
- 'value' => get_option( 'permalink_structure' ) ?: __( 'No permalink structure set' ),
- ),
- 'https_status' => array(
- 'label' => __( 'Is this site using HTTPS?' ),
- 'value' => ( is_ssl() ? __( 'Yes' ) : __( 'No' ) ),
- ),
- 'user_registration' => array(
- 'label' => __( 'Can anyone register on this site?' ),
- 'value' => ( get_option( 'users_can_register' ) ? __( 'Yes' ) : __( 'No' ) ),
- ),
- 'default_comment_status' => array(
- 'label' => __( 'Default comment status' ),
- 'value' => get_option( 'default_comment_status' ),
- ),
- 'multisite' => array(
- 'label' => __( 'Is this a multisite?' ),
- 'value' => ( is_multisite() ? __( 'Yes' ) : __( 'No' ) ),
- ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $info = array();
+
+ $info['wp-core'] = array(
+ 'label' => __( 'WordPress' ),
+ 'fields' => array(
+ 'version' => array(
+ 'label' => __( 'Version' ),
+ 'value' => $core_version . $core_update_needed,
+ 'debug' => $core_version,
</ins><span class="cx" style="display: block; padding: 0 10px"> ),
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'language' => array(
+ 'label' => __( 'Language' ),
+ 'value' => $locale,
+ ),
+ 'home_url' => array(
+ 'label' => __( 'Home URL' ),
+ 'value' => get_bloginfo( 'url' ),
+ 'private' => true,
+ ),
+ 'site_url' => array(
+ 'label' => __( 'Site URL' ),
+ 'value' => get_bloginfo( 'wpurl' ),
+ 'private' => true,
+ ),
+ 'permalink' => array(
+ 'label' => __( 'Permalink structure' ),
+ 'value' => $permalink_structure ?: __( 'No permalink structure set' ),
+ 'debug' => $permalink_structure,
+ ),
+ 'https_status' => array(
+ 'label' => __( 'Is this site using HTTPS?' ),
+ 'value' => ( $is_ssl ? __( 'Yes' ) : __( 'No' ) ),
+ 'debug' => $is_ssl,
+ ),
+ 'user_registration' => array(
+ 'label' => __( 'Can anyone register on this site?' ),
+ 'value' => ( $users_can_register ? __( 'Yes' ) : __( 'No' ) ),
+ 'debug' => $users_can_register,
+ ),
+ 'default_comment_status' => array(
+ 'label' => __( 'Default comment status' ),
+ 'value' => get_option( 'default_comment_status' ),
+ ),
+ 'multisite' => array(
+ 'label' => __( 'Is this a multisite?' ),
+ 'value' => ( $is_multisite ? __( 'Yes' ) : __( 'No' ) ),
+ 'debug' => $is_multisite,
+ ),
</ins><span class="cx" style="display: block; padding: 0 10px"> ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'wp-paths-sizes' => array(
- 'label' => __( 'Directories and Sizes' ),
- 'fields' => array(),
- ),
- 'wp-dropins' => array(
- 'label' => __( 'Drop-ins' ),
- 'show_count' => true,
- 'description' => __( 'Drop-ins are single files that replace or enhance WordPress features in ways that are not possible for traditional plugins.' ),
- 'fields' => array(),
- ),
- 'wp-active-theme' => array(
- 'label' => __( 'Active Theme' ),
- 'fields' => array(),
- ),
- 'wp-themes' => array(
- 'label' => __( 'Other Themes' ),
- 'show_count' => true,
- 'fields' => array(),
- ),
- 'wp-mu-plugins' => array(
- 'label' => __( 'Must Use Plugins' ),
- 'show_count' => true,
- 'fields' => array(),
- ),
- 'wp-plugins-active' => array(
- 'label' => __( 'Active Plugins' ),
- 'show_count' => true,
- 'fields' => array(),
- ),
- 'wp-plugins-inactive' => array(
- 'label' => __( 'Inactive Plugins' ),
- 'show_count' => true,
- 'fields' => array(),
- ),
- 'wp-media' => array(
- 'label' => __( 'Media Handling' ),
- 'fields' => array(),
- ),
- 'wp-server' => array(
- 'label' => __( 'Server' ),
- 'description' => __( 'The options shown below relate to your server setup. If changes are required, you may need your web host’s assistance.' ),
- 'fields' => array(),
- ),
- 'wp-database' => array(
- 'label' => __( 'Database' ),
- 'fields' => array(),
- ),
- 'wp-constants' => array(
- 'label' => __( 'WordPress Constants' ),
- 'description' => __( 'These settings alter where and how parts of WordPress are loaded.' ),
- 'fields' => array(
- 'ABSPATH' => array(
- 'label' => 'ABSPATH',
- 'value' => ABSPATH,
- 'private' => true,
- ),
- 'WP_HOME' => array(
- 'label' => 'WP_HOME',
- 'value' => ( ! defined( 'WP_HOME' ) ? __( 'Undefined' ) : WP_HOME ),
- ),
- 'WP_SITEURL' => array(
- 'label' => 'WP_SITEURL',
- 'value' => ( ! defined( 'WP_SITEURL' ) ? __( 'Undefined' ) : WP_SITEURL ),
- ),
- 'WP_CONTENT_DIR' => array(
- 'label' => 'WP_CONTENT_DIR',
- 'value' => WP_CONTENT_DIR,
- ),
- 'WP_PLUGIN_DIR' => array(
- 'label' => 'WP_PLUGIN_DIR',
- 'value' => WP_PLUGIN_DIR,
- ),
- 'WP_DEBUG' => array(
- 'label' => 'WP_DEBUG',
- 'value' => WP_DEBUG ? __( 'Enabled' ) : __( 'Disabled' ),
- ),
- 'WP_MAX_MEMORY_LIMIT' => array(
- 'label' => 'WP_MAX_MEMORY_LIMIT',
- 'value' => WP_MAX_MEMORY_LIMIT,
- ),
- 'WP_DEBUG_DISPLAY' => array(
- 'label' => 'WP_DEBUG_DISPLAY',
- 'value' => WP_DEBUG_DISPLAY ? __( 'Enabled' ) : __( 'Disabled' ),
- ),
- 'WP_DEBUG_LOG' => array(
- 'label' => 'WP_DEBUG_LOG',
- 'value' => ( is_string( WP_DEBUG_LOG ) ? WP_DEBUG_LOG : ( WP_DEBUG_LOG ? __( 'Enabled' ) : __( 'Disabled' ) ) ),
- ),
- 'SCRIPT_DEBUG' => array(
- 'label' => 'SCRIPT_DEBUG',
- 'value' => SCRIPT_DEBUG ? __( 'Enabled' ) : __( 'Disabled' ),
- ),
- 'WP_CACHE' => array(
- 'label' => 'WP_CACHE',
- 'value' => WP_CACHE ? __( 'Enabled' ) : __( 'Disabled' ),
- ),
- 'CONCATENATE_SCRIPTS' => array(
- 'label' => 'CONCATENATE_SCRIPTS',
- 'value' => ( ! defined( 'CONCATENATE_SCRIPTS' ) ? __( 'Undefined' ) : ( CONCATENATE_SCRIPTS ? __( 'Enabled' ) : __( 'Disabled' ) ) ),
- ),
- 'COMPRESS_SCRIPTS' => array(
- 'label' => 'COMPRESS_SCRIPTS',
- 'value' => ( ! defined( 'COMPRESS_SCRIPTS' ) ? __( 'Undefined' ) : ( COMPRESS_SCRIPTS ? __( 'Enabled' ) : __( 'Disabled' ) ) ),
- ),
- 'COMPRESS_CSS' => array(
- 'label' => 'COMPRESS_CSS',
- 'value' => ( ! defined( 'COMPRESS_CSS' ) ? __( 'Undefined' ) : ( COMPRESS_CSS ? __( 'Enabled' ) : __( 'Disabled' ) ) ),
- ),
- 'WP_LOCAL_DEV' => array(
- 'label' => 'WP_LOCAL_DEV',
- 'value' => ( ! defined( 'WP_LOCAL_DEV' ) ? __( 'Undefined' ) : ( WP_LOCAL_DEV ? __( 'Enabled' ) : __( 'Disabled' ) ) ),
- ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ );
+
+ $info['wp-paths-sizes'] = array(
+ 'label' => __( 'Directories and Sizes' ),
+ 'fields' => array(),
+ );
+
+ $info['wp-dropins'] = array(
+ 'label' => __( 'Drop-ins' ),
+ 'show_count' => true,
+ 'description' => __( 'Drop-ins are single files that replace or enhance WordPress features in ways that are not possible for traditional plugins.' ),
+ 'fields' => array(),
+ );
+
+ $info['wp-active-theme'] = array(
+ 'label' => __( 'Active Theme' ),
+ 'fields' => array(),
+ );
+
+ $info['wp-themes'] = array(
+ 'label' => __( 'Other Themes' ),
+ 'show_count' => true,
+ 'fields' => array(),
+ );
+
+ $info['wp-mu-plugins'] = array(
+ 'label' => __( 'Must Use Plugins' ),
+ 'show_count' => true,
+ 'fields' => array(),
+ );
+
+ $info['wp-plugins-active'] = array(
+ 'label' => __( 'Active Plugins' ),
+ 'show_count' => true,
+ 'fields' => array(),
+ );
+
+ $info['wp-plugins-inactive'] = array(
+ 'label' => __( 'Inactive Plugins' ),
+ 'show_count' => true,
+ 'fields' => array(),
+ );
+
+ $info['wp-media'] = array(
+ 'label' => __( 'Media Handling' ),
+ 'fields' => array(),
+ );
+
+ $info['wp-server'] = array(
+ 'label' => __( 'Server' ),
+ 'description' => __( 'The options shown below relate to your server setup. If changes are required, you may need your web host’s assistance.' ),
+ 'fields' => array(),
+ );
+
+ $info['wp-database'] = array(
+ 'label' => __( 'Database' ),
+ 'fields' => array(),
+ );
+
+ // Check if WP_DEBUG_LOG is set.
+ $wp_debug_log_value = __( 'Disabled' );
+
+ if ( is_string( WP_DEBUG_LOG ) ) {
+ $wp_debug_log_value = WP_DEBUG_LOG;
+ } elseif ( WP_DEBUG_LOG ) {
+ $wp_debug_log_value = __( 'Enabled' );
+ }
+
+ // Check CONCATENATE_SCRIPTS.
+ if ( defined( 'CONCATENATE_SCRIPTS' ) ) {
+ $concatenate_scripts = CONCATENATE_SCRIPTS ? __( 'Enabled' ) : __( 'Disabled' );
+ $concatenate_scripts_debug = CONCATENATE_SCRIPTS ? 'true' : 'false';
+ } else {
+ $concatenate_scripts = __( 'Undefined' );
+ $concatenate_scripts_debug = 'undefined';
+ }
+
+ // Check COMPRESS_SCRIPTS.
+ if ( defined( 'COMPRESS_SCRIPTS' ) ) {
+ $compress_scripts = COMPRESS_SCRIPTS ? __( 'Enabled' ) : __( 'Disabled' );
+ $compress_scripts_debug = COMPRESS_SCRIPTS ? 'true' : 'false';
+ } else {
+ $compress_scripts = __( 'Undefined' );
+ $compress_scripts_debug = 'undefined';
+ }
+
+ // Check COMPRESS_CSS.
+ if ( defined( 'COMPRESS_CSS' ) ) {
+ $compress_css = COMPRESS_CSS ? __( 'Enabled' ) : __( 'Disabled' );
+ $compress_css_debug = COMPRESS_CSS ? 'true' : 'false';
+ } else {
+ $compress_css = __( 'Undefined' );
+ $compress_css_debug = 'undefined';
+ }
+
+ // Check WP_LOCAL_DEV.
+ if ( defined( 'WP_LOCAL_DEV' ) ) {
+ $wp_local_dev = WP_LOCAL_DEV ? __( 'Enabled' ) : __( 'Disabled' );
+ $wp_local_dev_debug = WP_LOCAL_DEV ? 'true' : 'false';
+ } else {
+ $wp_local_dev = __( 'Undefined' );
+ $wp_local_dev_debug = 'undefined';
+ }
+
+ $info['wp-constants'] = array(
+ 'label' => __( 'WordPress Constants' ),
+ 'description' => __( 'These settings alter where and how parts of WordPress are loaded.' ),
+ 'fields' => array(
+ 'ABSPATH' => array(
+ 'label' => 'ABSPATH',
+ 'value' => ABSPATH,
+ 'private' => true,
</ins><span class="cx" style="display: block; padding: 0 10px"> ),
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'WP_HOME' => array(
+ 'label' => 'WP_HOME',
+ 'value' => ( defined( 'WP_HOME' ) ? WP_HOME : __( 'Undefined' ) ),
+ 'debug' => ( defined( 'WP_HOME' ) ? WP_HOME : 'undefined' ),
+ ),
+ 'WP_SITEURL' => array(
+ 'label' => 'WP_SITEURL',
+ 'value' => ( defined( 'WP_SITEURL' ) ? WP_SITEURL : __( 'Undefined' ) ),
+ 'debug' => ( defined( 'WP_SITEURL' ) ? WP_SITEURL : 'undefined' ),
+ ),
+ 'WP_CONTENT_DIR' => array(
+ 'label' => 'WP_CONTENT_DIR',
+ 'value' => WP_CONTENT_DIR,
+ ),
+ 'WP_PLUGIN_DIR' => array(
+ 'label' => 'WP_PLUGIN_DIR',
+ 'value' => WP_PLUGIN_DIR,
+ ),
+ 'WP_DEBUG' => array(
+ 'label' => 'WP_DEBUG',
+ 'value' => WP_DEBUG ? __( 'Enabled' ) : __( 'Disabled' ),
+ 'debug' => WP_DEBUG,
+ ),
+ 'WP_MAX_MEMORY_LIMIT' => array(
+ 'label' => 'WP_MAX_MEMORY_LIMIT',
+ 'value' => WP_MAX_MEMORY_LIMIT,
+ ),
+ 'WP_DEBUG_DISPLAY' => array(
+ 'label' => 'WP_DEBUG_DISPLAY',
+ 'value' => WP_DEBUG_DISPLAY ? __( 'Enabled' ) : __( 'Disabled' ),
+ 'debug' => WP_DEBUG_DISPLAY,
+ ),
+ 'WP_DEBUG_LOG' => array(
+ 'label' => 'WP_DEBUG_LOG',
+ 'value' => $wp_debug_log_value,
+ 'debug' => WP_DEBUG_LOG,
+ ),
+ 'SCRIPT_DEBUG' => array(
+ 'label' => 'SCRIPT_DEBUG',
+ 'value' => SCRIPT_DEBUG ? __( 'Enabled' ) : __( 'Disabled' ),
+ 'debug' => SCRIPT_DEBUG,
+ ),
+ 'WP_CACHE' => array(
+ 'label' => 'WP_CACHE',
+ 'value' => WP_CACHE ? __( 'Enabled' ) : __( 'Disabled' ),
+ 'debug' => WP_CACHE,
+ ),
+ 'CONCATENATE_SCRIPTS' => array(
+ 'label' => 'CONCATENATE_SCRIPTS',
+ 'value' => $concatenate_scripts,
+ 'debug' => $concatenate_scripts_debug,
+ ),
+ 'COMPRESS_SCRIPTS' => array(
+ 'label' => 'COMPRESS_SCRIPTS',
+ 'value' => $compress_scripts,
+ 'debug' => $compress_scripts_debug,
+ ),
+ 'COMPRESS_CSS' => array(
+ 'label' => 'COMPRESS_CSS',
+ 'value' => $compress_css,
+ 'debug' => $compress_css_debug,
+ ),
+ 'WP_LOCAL_DEV' => array(
+ 'label' => 'WP_LOCAL_DEV',
+ 'value' => $wp_local_dev,
+ 'debug' => $wp_local_dev_debug,
+ ),
</ins><span class="cx" style="display: block; padding: 0 10px"> ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'wp-filesystem' => array(
- 'label' => __( 'Filesystem Permissions' ),
- 'description' => __( 'Shows whether WordPress is able to write to the directories it needs access to.' ),
- 'fields' => array(
- 'all' => array(
- 'label' => __( 'The main WordPress directory' ),
- 'value' => ( wp_is_writable( ABSPATH ) ? __( 'Writable' ) : __( 'Not writable' ) ),
- ),
- 'wp-content' => array(
- 'label' => __( 'The wp-content directory' ),
- 'value' => ( wp_is_writable( WP_CONTENT_DIR ) ? __( 'Writable' ) : __( 'Not writable' ) ),
- ),
- 'uploads' => array(
- 'label' => __( 'The uploads directory' ),
- 'value' => ( wp_is_writable( $upload_dir['basedir'] ) ? __( 'Writable' ) : __( 'Not writable' ) ),
- ),
- 'plugins' => array(
- 'label' => __( 'The plugins directory' ),
- 'value' => ( wp_is_writable( WP_PLUGIN_DIR ) ? __( 'Writable' ) : __( 'Not writable' ) ),
- ),
- 'themes' => array(
- 'label' => __( 'The themes directory' ),
- 'value' => ( wp_is_writable( get_template_directory() . '/..' ) ? __( 'Writable' ) : __( 'Not writable' ) ),
- ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ );
+
+ $is_writable_abspath = wp_is_writable( ABSPATH );
+ $is_writable_wp_content_dir = wp_is_writable( WP_CONTENT_DIR );
+ $is_writable_upload_dir = wp_is_writable( $upload_dir['basedir'] );
+ $is_writable_wp_plugin_dir = wp_is_writable( WP_PLUGIN_DIR );
+ $is_writable_template_directory = wp_is_writable( get_template_directory() . '/..' );
+
+ $info['wp-filesystem'] = array(
+ 'label' => __( 'Filesystem Permissions' ),
+ 'description' => __( 'Shows whether WordPress is able to write to the directories it needs access to.' ),
+ 'fields' => array(
+ 'wordpress' => array(
+ 'label' => __( 'The main WordPress directory' ),
+ 'value' => ( $is_writable_abspath ? __( 'Writable' ) : __( 'Not writable' ) ),
+ 'debug' => ( $is_writable_abspath ? 'writable' : 'not writable' ),
</ins><span class="cx" style="display: block; padding: 0 10px"> ),
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'wp-content' => array(
+ 'label' => __( 'The wp-content directory' ),
+ 'value' => ( $is_writable_wp_content_dir ? __( 'Writable' ) : __( 'Not writable' ) ),
+ 'debug' => ( $is_writable_wp_content_dir ? 'writable' : 'not writable' ),
+ ),
+ 'uploads' => array(
+ 'label' => __( 'The uploads directory' ),
+ 'value' => ( $is_writable_upload_dir ? __( 'Writable' ) : __( 'Not writable' ) ),
+ 'debug' => ( $is_writable_upload_dir ? 'writable' : 'not writable' ),
+ ),
+ 'plugins' => array(
+ 'label' => __( 'The plugins directory' ),
+ 'value' => ( $is_writable_wp_plugin_dir ? __( 'Writable' ) : __( 'Not writable' ) ),
+ 'debug' => ( $is_writable_wp_plugin_dir ? 'writable' : 'not writable' ),
+ ),
+ 'themes' => array(
+ 'label' => __( 'The themes directory' ),
+ 'value' => ( $is_writable_template_directory ? __( 'Writable' ) : __( 'Not writable' ) ),
+ 'debug' => ( $is_writable_template_directory ? 'writable' : 'not writable' ),
+ ),
</ins><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -255,14 +340,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $site_count += get_blog_count( $network_id );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $info['wp-core']['fields']['user_count'] = array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $info['wp-core']['fields']['user_count'] = array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'User count' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'value' => get_user_count(),
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $info['wp-core']['fields']['site_count'] = array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ $info['wp-core']['fields']['site_count'] = array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Site count' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'value' => $site_count,
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> $info['wp-core']['fields']['network_count'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Network count' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'value' => $network_query->found_networks,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -277,18 +364,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // WordPress features requiring processing.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $wp_dotorg = wp_remote_get(
- 'https://wordpress.org',
- array(
- 'timeout' => 10,
- )
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_dotorg = wp_remote_get( 'https://wordpress.org', array( 'timeout' => 10 ) );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! is_wp_error( $wp_dotorg ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $info['wp-core']['fields']['dotorg_communication'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Communication with WordPress.org' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'value' => sprintf(
- __( 'WordPress.org is reachable' )
- ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'value' => __( 'WordPress.org is reachable' ),
+ 'debug' => 'true',
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> $info['wp-core']['fields']['dotorg_communication'] = array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -299,6 +381,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> gethostbyname( 'wordpress.org' ),
</span><span class="cx" style="display: block; padding: 0 10px"> $wp_dotorg->get_error_message()
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'debug' => $wp_dotorg->get_error_message(),
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -350,9 +433,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $timeout = __( 'The directory size calculation has timed out. Usually caused by a very large number of sub-directories and files.' );
- $inaccessible = __( 'The size cannot be calculated. The directory is not accessible. Usually caused by invalid permissions.' );
- $size_total = 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $size_total = 0;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Loop over all the directories we want to gather the sizes for.
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $size_directories as $size => $attributes ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -362,14 +443,18 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $dir_size = get_dirsize( $attributes['path'], $max_execution_time );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $dir_size === false ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( false === $dir_size ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> // Error reading.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $dir_size = $inaccessible;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $size_directories[ $size ]['size'] = __( 'The size cannot be calculated. The directory is not accessible. Usually caused by invalid permissions.' );
+ $size_directories[ $size ]['debug'] = 'not accessible';
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // Stop total size calculation.
</span><span class="cx" style="display: block; padding: 0 10px"> $size_total = null;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } elseif ( $dir_size === null ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } elseif ( null === $dir_size ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> // Timeout.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $dir_size = $timeout;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $size_directories[ $size ]['size'] = __( 'The directory size calculation has timed out. Usually caused by a very large number of sub-directories and files.' );
+ $size_directories[ $size ]['debug'] = 'timeout while calculating size';
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // Stop total size calculation.
</span><span class="cx" style="display: block; padding: 0 10px"> $size_total = null;
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -376,76 +461,87 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $is_subdir = ( strpos( $size_directories[ $size ]['path'], ABSPATH ) === 0 );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // phpcs:ignore WordPress.WP.CapitalPDangit.Misspelled
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $size_total !== null && ( $size === 'wordpress' || ! $is_subdir ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( null !== $size_total && ( 'wordpress' === $size || ! $is_subdir ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $size_total += $dir_size;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $dir_size = size_format( $dir_size, 2 );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $size_directories[ $size ]['size'] = size_format( $dir_size, 2 );
+ $size_directories[ $size ]['debug'] = $size_directories[ $size ]['size'];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- $size_directories[ $size ]['size'] = $dir_size;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $size_total !== null && $size_db > 0 ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( null !== $size_total && $size_db > 0 ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $size_total = size_format( $size_total + $size_db, 2 );
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $size_total = __( 'Total size is not available. Some errors were encountered when determining the size of your installation.' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $size_total = 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $info['wp-paths-sizes']['fields'] = array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'uploads_path' => array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Uploads Directory Location' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'value' => $size_directories['uploads']['path'],
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'uploads_size' => array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Uploads Directory Size' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'value' => $size_directories['uploads']['size'],
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'debug' => $size_directories['uploads']['debug'],
</ins><span class="cx" style="display: block; padding: 0 10px"> ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'themes_path' => array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Themes Directory Location' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'value' => $size_directories['themes']['path'],
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'current_theme_path' => array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Current Theme Directory' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'value' => get_template_directory(),
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'themes_size' => array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Themes Directory Size' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'value' => $size_directories['themes']['size'],
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'debug' => $size_directories['themes']['debug'],
</ins><span class="cx" style="display: block; padding: 0 10px"> ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'plugins_path' => array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Plugins Directory Location' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'value' => $size_directories['plugins']['path'],
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'plugins_size' => array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Plugins Directory Size' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'value' => $size_directories['plugins']['size'],
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'debug' => $size_directories['plugins']['debug'],
</ins><span class="cx" style="display: block; padding: 0 10px"> ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'wordpress_path' => array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'WordPress Directory Location' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'value' => $size_directories['wordpress']['path'],
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'wordpress_size' => array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'WordPress Directory Size' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'value' => $size_directories['wordpress']['size'],
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'debug' => $size_directories['wordpress']['debug'],
</ins><span class="cx" style="display: block; padding: 0 10px"> ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'database_size' => array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Database size' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'value' => size_format( $size_db, 2 ),
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'total_size' => array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Total installation size' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'value' => $size_total,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'value' => $size_total > 0 ? $size_total : __( 'Total size is not available. Some errors were encountered when determining the size of your installation.' ),
+ 'debug' => $size_total > 0 ? $size_total : 'not available',
</ins><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Get a list of all drop-in replacements.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $dropins = get_dropins();
- $dropin_description = _get_dropins();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $dropins = get_dropins();
+
+ // Get dropins descriptions.
+ $dropin_descriptions = _get_dropins();
+
+ // Spare few function calls.
+ $not_available = __( 'Not available' );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ( $dropins as $dropin_key => $dropin ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $info['wp-dropins']['fields'][ sanitize_key( $dropin_key ) ] = array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $info['wp-dropins']['fields'][ sanitize_text_field( $dropin_key ) ] = array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'label' => $dropin_key,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'value' => $dropin_description[ $dropin_key ][0],
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'value' => $dropin_descriptions[ $dropin_key ][0],
+ 'debug' => 'true',
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -463,11 +559,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> $imagick_version = __( 'Not available' );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> $info['wp-media']['fields']['imagick_module_version'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'ImageMagick version number' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'value' => ( is_array( $imagick_version ) ? $imagick_version['versionNumber'] : $imagick_version ),
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $info['wp-media']['fields']['imagemagick_version'] = array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ $info['wp-media']['fields']['imagemagick_version'] = array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'ImageMagick version string' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'value' => ( is_array( $imagick_version ) ? $imagick_version['versionString'] : $imagick_version ),
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -475,17 +573,27 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // If Imagick is used as our editor, provide some more information about its limitations.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'WP_Image_Editor_Imagick' === _wp_image_editor_choose() && isset( $imagick ) && $imagick instanceof Imagick ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $limits = array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'area' => ( defined( 'imagick::RESOURCETYPE_AREA' ) ? size_format( $imagick->getResourceLimit( imagick::RESOURCETYPE_AREA ) ) : __( 'Not available' ) ),
- 'disk' => ( defined( 'imagick::RESOURCETYPE_DISK' ) ? $imagick->getResourceLimit( imagick::RESOURCETYPE_DISK ) : __( 'Not available' ) ),
- 'file' => ( defined( 'imagick::RESOURCETYPE_FILE' ) ? $imagick->getResourceLimit( imagick::RESOURCETYPE_FILE ) : __( 'Not available' ) ),
- 'map' => ( defined( 'imagick::RESOURCETYPE_MAP' ) ? size_format( $imagick->getResourceLimit( imagick::RESOURCETYPE_MAP ) ) : __( 'Not available' ) ),
- 'memory' => ( defined( 'imagick::RESOURCETYPE_MEMORY' ) ? size_format( $imagick->getResourceLimit( imagick::RESOURCETYPE_MEMORY ) ) : __( 'Not available' ) ),
- 'thread' => ( defined( 'imagick::RESOURCETYPE_THREAD' ) ? $imagick->getResourceLimit( imagick::RESOURCETYPE_THREAD ) : __( 'Not available' ) ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'area' => ( defined( 'imagick::RESOURCETYPE_AREA' ) ? size_format( $imagick->getResourceLimit( imagick::RESOURCETYPE_AREA ) ) : $not_available ),
+ 'disk' => ( defined( 'imagick::RESOURCETYPE_DISK' ) ? $imagick->getResourceLimit( imagick::RESOURCETYPE_DISK ) : $not_available ),
+ 'file' => ( defined( 'imagick::RESOURCETYPE_FILE' ) ? $imagick->getResourceLimit( imagick::RESOURCETYPE_FILE ) : $not_available ),
+ 'map' => ( defined( 'imagick::RESOURCETYPE_MAP' ) ? size_format( $imagick->getResourceLimit( imagick::RESOURCETYPE_MAP ) ) : $not_available ),
+ 'memory' => ( defined( 'imagick::RESOURCETYPE_MEMORY' ) ? size_format( $imagick->getResourceLimit( imagick::RESOURCETYPE_MEMORY ) ) : $not_available ),
+ 'thread' => ( defined( 'imagick::RESOURCETYPE_THREAD' ) ? $imagick->getResourceLimit( imagick::RESOURCETYPE_THREAD ) : $not_available ),
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $limits_debug = array(
+ 'imagick::RESOURCETYPE_AREA' => ( defined( 'imagick::RESOURCETYPE_AREA' ) ? size_format( $imagick->getResourceLimit( imagick::RESOURCETYPE_AREA ) ) : 'not available' ),
+ 'imagick::RESOURCETYPE_DISK' => ( defined( 'imagick::RESOURCETYPE_DISK' ) ? $imagick->getResourceLimit( imagick::RESOURCETYPE_DISK ) : 'not available' ),
+ 'imagick::RESOURCETYPE_FILE' => ( defined( 'imagick::RESOURCETYPE_FILE' ) ? $imagick->getResourceLimit( imagick::RESOURCETYPE_FILE ) : 'not available' ),
+ 'imagick::RESOURCETYPE_MAP' => ( defined( 'imagick::RESOURCETYPE_MAP' ) ? size_format( $imagick->getResourceLimit( imagick::RESOURCETYPE_MAP ) ) : 'not available' ),
+ 'imagick::RESOURCETYPE_MEMORY' => ( defined( 'imagick::RESOURCETYPE_MEMORY' ) ? size_format( $imagick->getResourceLimit( imagick::RESOURCETYPE_MEMORY ) ) : 'not available' ),
+ 'imagick::RESOURCETYPE_THREAD' => ( defined( 'imagick::RESOURCETYPE_THREAD' ) ? $imagick->getResourceLimit( imagick::RESOURCETYPE_THREAD ) : 'not available' ),
+ );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $info['wp-media']['fields']['imagick_limits'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Imagick Resource Limits' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'value' => $limits,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'debug' => $limits_debug,
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -495,44 +603,85 @@
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> $gd = false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> $info['wp-media']['fields']['gd_version'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'GD version' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'value' => ( is_array( $gd ) ? $gd['GD Version'] : __( 'Not available' ) ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'value' => ( is_array( $gd ) ? $gd['GD Version'] : $not_available ),
+ 'debug' => ( is_array( $gd ) ? $gd['GD Version'] : 'not available' ),
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Get Ghostscript information, if available.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( function_exists( 'exec' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $gs = exec( 'gs --version' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $gs = ( ! empty( $gs ) ? $gs : __( 'Not available' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ if ( empty( $gs ) ) {
+ $gs = $not_available;
+ $gs_debug = 'not available';
+ } else {
+ $gs_debug = $gs;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $gs = __( 'Unable to determine if Ghostscript is installed' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $gs = __( 'Unable to determine if Ghostscript is installed' );
+ $gs_debug = 'unknown';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> $info['wp-media']['fields']['ghostscript_version'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Ghostscript version' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'value' => $gs,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'debug' => $gs_debug,
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Populate the server debug fields.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( function_exists( 'php_uname' ) ) {
+ $server_architecture = sprintf( '%s %s %s', php_uname( 's' ), php_uname( 'r' ), php_uname( 'm' ) );
+ } else {
+ $server_architecture = 'unknown';
+ }
+
+ if ( function_exists( 'phpversion' ) ) {
+ $php_version_debug = phpversion();
+ // Whether PHP supports 64bit
+ $php64bit = ( PHP_INT_SIZE * 8 === 64 );
+
+ $php_version = sprintf(
+ '%s %s',
+ $php_version_debug,
+ ( $php64bit ? __( '(Supports 64bit values)' ) : __( '(Does not support 64bit values)' ) )
+ );
+
+ if ( $php64bit ) {
+ $php_version_debug .= ' 64bit';
+ }
+ } else {
+ $php_version = __( 'Unable to determine PHP version' );
+ $php_version_debug = 'unknown';
+ }
+
+ if ( function_exists( 'php_sapi_name' ) ) {
+ $php_sapi = php_sapi_name();
+ } else {
+ $php_sapi = 'unknown';
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $info['wp-server']['fields']['server_architecture'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Server architecture' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'value' => ( ! function_exists( 'php_uname' ) ? __( 'Unable to determine server architecture' ) : sprintf( '%s %s %s', php_uname( 's' ), php_uname( 'r' ), php_uname( 'm' ) ) ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'value' => ( 'unknown' !== $server_architecture ? $server_architecture : __( 'Unable to determine server architecture' ) ),
+ 'debug' => $server_architecture,
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> $info['wp-server']['fields']['httpd_software'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Web server' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'value' => ( isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : __( 'Unable to determine what web server software is used' ) ),
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'debug' => ( isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : 'unknown' ),
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> $info['wp-server']['fields']['php_version'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'PHP version' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'value' => ( ! function_exists( 'phpversion' ) ? __( 'Unable to determine PHP version' ) : sprintf(
- '%s %s',
- phpversion(),
- ( 64 === PHP_INT_SIZE * 8 ? __( '(Supports 64bit values)' ) : __( '(Does not support 64bit values)' ) )
- )
- ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'value' => $php_version,
+ 'debug' => $php_version_debug,
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> $info['wp-server']['fields']['php_sapi'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'PHP SAPI' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'value' => ( ! function_exists( 'php_sapi_name' ) ? __( 'Unable to determine PHP SAPI' ) : php_sapi_name() ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'value' => ( 'unknown' !== $php_sapi ? $php_sapi : __( 'Unable to determine PHP SAPI' ) ),
+ 'debug' => $php_sapi,
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Some servers disable `ini_set()` and `ini_get()`, we check this before trying to get configuration values.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -540,6 +689,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $info['wp-server']['fields']['ini_get'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Server settings' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'value' => __( 'Unable to determine some settings, as the ini_get() function has been disabled.' ),
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'debug' => 'ini_get() is disabled',
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> $info['wp-server']['fields']['max_input_variables'] = array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -578,18 +728,27 @@
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> $info['wp-server']['fields']['curl_version'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'cURL version' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'value' => __( 'Not available' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'value' => $not_available,
+ 'debug' => 'not available',
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // SUHOSIN
+ $suhosin_loaded = ( extension_loaded( 'suhosin' ) || ( defined( 'SUHOSIN_PATCH' ) && constant( 'SUHOSIN_PATCH' ) ) );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $info['wp-server']['fields']['suhosin'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Is SUHOSIN installed?' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'value' => ( ( extension_loaded( 'suhosin' ) || ( defined( 'SUHOSIN_PATCH' ) && constant( 'SUHOSIN_PATCH' ) ) ) ? __( 'Yes' ) : __( 'No' ) ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'value' => ( $suhosin_loaded ? __( 'Yes' ) : __( 'No' ) ),
+ 'debug' => $suhosin_loaded,
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Imagick
+ $imagick_loaded = extension_loaded( 'imagick' );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $info['wp-server']['fields']['imagick_availability'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Is the Imagick library available?' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'value' => ( extension_loaded( 'imagick' ) ? __( 'Yes' ) : __( 'No' ) ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'value' => ( $imagick_loaded ? __( 'Yes' ) : __( 'No' ) ),
+ 'debug' => $imagick_loaded,
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Check if a .htaccess file exists.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -599,10 +758,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Filter away the core WordPress rules.
</span><span class="cx" style="display: block; padding: 0 10px"> $filtered_htaccess_content = trim( preg_replace( '/\# BEGIN WordPress[\s\S]+?# END WordPress/si', '', $htaccess_content ) );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $filtered_htaccess_content = ! empty( $filtered_htaccess_content );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $info['wp-server']['fields']['htaccess_extra_rules'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'htaccess rules' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'value' => ( ! empty( $filtered_htaccess_content ) ? __( 'Custom rules have been added to your htaccess file.' ) : __( 'Your htaccess file contains only core WordPress features.' ) ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'value' => ( $filtered_htaccess_content ? __( 'Custom rules have been added to your htaccess file.' ) : __( 'Your htaccess file contains only core WordPress features.' ) ),
+ 'debug' => $filtered_htaccess_content,
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -646,33 +807,39 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $info['wp-database']['fields']['extension'] = array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $info['wp-database']['fields']['extension'] = array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Extension' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'value' => $extension,
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $info['wp-database']['fields']['server_version'] = array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ $info['wp-database']['fields']['server_version'] = array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Server version' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'value' => $server,
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $info['wp-database']['fields']['client_version'] = array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ $info['wp-database']['fields']['client_version'] = array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Client version' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'value' => $client_version,
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $info['wp-database']['fields']['database_user'] = array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ $info['wp-database']['fields']['database_user'] = array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Database user' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'value' => $wpdb->dbuser,
</span><span class="cx" style="display: block; padding: 0 10px"> 'private' => true,
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $info['wp-database']['fields']['database_host'] = array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ $info['wp-database']['fields']['database_host'] = array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Database host' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'value' => $wpdb->dbhost,
</span><span class="cx" style="display: block; padding: 0 10px"> 'private' => true,
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $info['wp-database']['fields']['database_name'] = array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ $info['wp-database']['fields']['database_name'] = array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Database name' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'value' => $wpdb->dbname,
</span><span class="cx" style="display: block; padding: 0 10px"> 'private' => true,
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> $info['wp-database']['fields']['database_prefix'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Database prefix' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'value' => $wpdb->prefix,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -686,24 +853,31 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $plugin_version = $plugin['Version'];
</span><span class="cx" style="display: block; padding: 0 10px"> $plugin_author = $plugin['Author'];
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $plugin_version_string = __( 'No version or author information is available.' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $plugin_version_string = __( 'No version or author information is available.' );
+ $plugin_version_string_debug = 'author: (undefined), version: (undefined)';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $plugin_version ) && ! empty( $plugin_author ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // translators: 1: Plugin version number. 2: Plugin author name.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $plugin_version_string = sprintf( __( 'Version %1$s by %2$s' ), $plugin_version, $plugin_author );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $plugin_version_string = sprintf( __( 'Version %1$s by %2$s' ), $plugin_version, $plugin_author );
+ $plugin_version_string_debug = sprintf( 'version: %s, author: %s', $plugin_version, $plugin_author );
+ } else {
+ if ( ! empty( $plugin_author ) ) {
+ // translators: %s: Plugin author name.
+ $plugin_version_string = sprintf( __( 'By %s' ), $plugin_author );
+ $plugin_version_string_debug = sprintf( 'author: %s, version: (undefined)', $plugin_author );
+ }
+
+ if ( ! empty( $plugin_version ) ) {
+ // translators: %s: Plugin version number.
+ $plugin_version_string = sprintf( __( 'Version %s' ), $plugin_version );
+ $plugin_version_string_debug = sprintf( 'author: (undefined), version: %s', $plugin_version );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( empty( $plugin_version ) && ! empty( $plugin_author ) ) {
- // translators: %s: Plugin author name.
- $plugin_version_string = sprintf( __( 'By %s' ), $plugin_author );
- }
- if ( ! empty( $plugin_version ) && empty( $plugin_author ) ) {
- // translators: %s: Plugin version number.
- $plugin_version_string = sprintf( __( 'Version %s' ), $plugin_version );
- }
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $info['wp-mu-plugins']['fields'][ sanitize_key( $plugin['Name'] ) ] = array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $info['wp-mu-plugins']['fields'][ sanitize_text_field( $plugin['Name'] ) ] = array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'label' => $plugin['Name'],
</span><span class="cx" style="display: block; padding: 0 10px"> 'value' => $plugin_version_string,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'debug' => $plugin_version_string_debug,
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -717,31 +891,37 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $plugin_version = $plugin['Version'];
</span><span class="cx" style="display: block; padding: 0 10px"> $plugin_author = $plugin['Author'];
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $plugin_version_string = __( 'No version or author information is available.' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $plugin_version_string = __( 'No version or author information is available.' );
+ $plugin_version_string_debug = 'author: (undefined), version: (undefined)';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $plugin_version ) && ! empty( $plugin_author ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // translators: 1: Plugin version number. 2: Plugin author name.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $plugin_version_string = sprintf( __( 'Version %1$s by %2$s' ), $plugin_version, $plugin_author );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $plugin_version_string = sprintf( __( 'Version %1$s by %2$s' ), $plugin_version, $plugin_author );
+ $plugin_version_string_debug = sprintf( 'version: %s, author: %s', $plugin_version, $plugin_author );
+ } else {
+ if ( ! empty( $plugin_author ) ) {
+ // translators: %s: Plugin author name.
+ $plugin_version_string = sprintf( __( 'By %s' ), $plugin_author );
+ $plugin_version_string_debug = sprintf( 'author: %s, version: (undefined)', $plugin_author );
+ }
+
+ if ( ! empty( $plugin_version ) ) {
+ // translators: %s: Plugin version number.
+ $plugin_version_string = sprintf( __( 'Version %s' ), $plugin_version );
+ $plugin_version_string_debug = sprintf( 'author: (undefined), version: %s', $plugin_version );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( empty( $plugin_version ) && ! empty( $plugin_author ) ) {
- // translators: %s: Plugin author name.
- $plugin_version_string = sprintf( __( 'By %s' ), $plugin_author );
- }
- if ( ! empty( $plugin_version ) && empty( $plugin_author ) ) {
- // translators: %s: Plugin version number.
- $plugin_version_string = sprintf( __( 'Version %s' ), $plugin_version );
- }
</del><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( array_key_exists( $plugin_path, $plugin_updates ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // translators: %s: Latest plugin version number.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $plugin_update_needed = ' ' . sprintf( __( '(Latest version: %s)' ), $plugin_updates[ $plugin_path ]->update->new_version );
- } else {
- $plugin_update_needed = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $plugin_version_string .= ' ' . sprintf( __( '(Latest version: %s)' ), $plugin_updates[ $plugin_path ]->update->new_version );
+ $plugin_version_string_debug .= sprintf( ' (latest version: %s)', $plugin_updates[ $plugin_path ]->update->new_version );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $info[ $plugin_part ]['fields'][ sanitize_key( $plugin['Name'] ) ] = array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $info[ $plugin_part ]['fields'][ sanitize_text_field( $plugin['Name'] ) ] = array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'label' => $plugin['Name'],
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'value' => $plugin_version_string . $plugin_update_needed,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'value' => $plugin_version_string,
+ 'debug' => $plugin_version_string_debug,
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -748,6 +928,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Populate the section for the currently active theme.
</span><span class="cx" style="display: block; padding: 0 10px"> global $_wp_theme_features;
</span><span class="cx" style="display: block; padding: 0 10px"> $theme_features = array();
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $_wp_theme_features ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $_wp_theme_features as $feature => $options ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $theme_features[] = $feature;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -757,13 +938,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $active_theme = wp_get_theme();
</span><span class="cx" style="display: block; padding: 0 10px"> $theme_updates = get_theme_updates();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
+ $active_theme_version = $active_theme->Version;
+ $active_theme_version_debug = $active_theme_version;
+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( array_key_exists( $active_theme->stylesheet, $theme_updates ) ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $theme_update_new_version = $theme_updates[ $active_theme->stylesheet ]->update['new_version'];
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // translators: %s: Latest theme version number.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $theme_update_needed_active = ' ' . sprintf( __( '(Latest version: %s)' ), $theme_updates[ $active_theme->stylesheet ]->update['new_version'] );
- } else {
- $theme_update_needed_active = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $active_theme_version .= ' ' . sprintf( __( '(Latest version: %s)' ), $theme_update_new_version );
+ $active_theme_version_debug .= sprintf( ' (latest version: %s)', $theme_update_new_version );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $active_theme_author_uri = $active_theme->offsetGet( 'Author URI' );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $info['wp-active-theme']['fields'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'name' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Name' ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -772,8 +960,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'version' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Version' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
- 'value' => $active_theme->Version . $theme_update_needed_active,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'value' => $active_theme_version,
+ 'debug' => $active_theme_version_debug,
</ins><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'author' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Author' ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -782,11 +970,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'author_website' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Author website' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'value' => ( $active_theme->offsetGet( 'Author URI' ) ? $active_theme->offsetGet( 'Author URI' ) : __( 'Undefined' ) ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'value' => ( $active_theme_author_uri ? $active_theme_author_uri : __( 'Undefined' ) ),
+ 'debug' => ( $active_theme_author_uri ? $active_theme_author_uri : '(undefined)' ),
</ins><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'parent_theme' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Parent theme' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'value' => ( $active_theme->parent_theme ? $active_theme->parent_theme : __( 'None' ) ),
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'debug' => ( $active_theme->parent_theme ? $active_theme->parent_theme : 'none' ),
</ins><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'theme_features' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'Theme features' ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -799,7 +989,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $all_themes as $theme_slug => $theme ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // Ignore the currently active theme from the list of all themes.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $active_theme->stylesheet == $theme_slug ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $active_theme->stylesheet === $theme_slug ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> continue;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -807,29 +997,38 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
</span><span class="cx" style="display: block; padding: 0 10px"> $theme_author = $theme->Author;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $theme_version_string = __( 'No version or author information is available.' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Sanitize
+ $theme_author = wp_kses( $theme_author, array() );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $theme_version_string = __( 'No version or author information is available.' );
+ $theme_version_string_debug = 'undefined';
+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $theme_version ) && ! empty( $theme_author ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // translators: 1: Theme version number. 2: Theme author name.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $theme_version_string = sprintf( __( 'Version %1$s by %2$s' ), $theme_version, wp_kses( $theme_author, array() ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $theme_version_string = sprintf( __( 'Version %1$s by %2$s' ), $theme_version, $theme_author );
+ $theme_version_string_debug = sprintf( 'version: %s, author: %s', $theme_version, $theme_author );
+ } else {
+ if ( ! empty( $theme_author ) ) {
+ // translators: %s: Theme author name.
+ $theme_version_string = sprintf( __( 'By %s' ), $theme_author );
+ $theme_version_string_debug = sprintf( 'author: %s, version: (undefined)', $theme_author );
+ }
+
+ if ( ! empty( $theme_version ) ) {
+ // translators: %s: Theme version number.
+ $theme_version_string = sprintf( __( 'Version %s' ), $theme_version );
+ $theme_version_string_debug = sprintf( 'author: (undefined), version: %s', $theme_version );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( empty( $theme_version ) && ! empty( $theme_author ) ) {
- // translators: %s: Theme author name.
- $theme_version_string = sprintf( __( 'By %s' ), wp_kses( $theme_author, array() ) );
- }
- if ( ! empty( $theme_version ) && empty( $theme_author ) ) {
- // translators: %s: Theme version number.
- $theme_version_string = sprintf( __( 'Version %s' ), $theme_version );
- }
</del><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( array_key_exists( $theme_slug, $theme_updates ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // translators: %s: Latest theme version number.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $theme_update_needed = ' ' . sprintf( __( '(Latest version: %s)' ), $theme_updates[ $theme_slug ]->update['new_version'] );
- } else {
- $theme_update_needed = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $theme_version_string .= ' ' . sprintf( __( '(Latest version: %s)' ), $theme_updates[ $theme_slug ]->update['new_version'] );
+ $theme_version_string_debug .= sprintf( ' (latest version: %s)', $theme_updates[ $theme_slug ]->update['new_version'] );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $info['wp-themes']['fields'][ sanitize_key( $theme->Name ) ] = array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
+ $info['wp-themes']['fields'][ sanitize_text_field( $theme->Name ) ] = array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'label' => sprintf(
</span><span class="cx" style="display: block; padding: 0 10px"> // translators: 1: Theme name. 2: Theme slug.
</span><span class="cx" style="display: block; padding: 0 10px"> __( '%1$s (%2$s)' ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -837,26 +1036,31 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $theme->Name,
</span><span class="cx" style="display: block; padding: 0 10px"> $theme_slug
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'value' => $theme_version_string . $theme_update_needed,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'value' => $theme_version_string,
+ 'debug' => $theme_version_string_debug,
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Add more filesystem checks
</span><span class="cx" style="display: block; padding: 0 10px"> if ( defined( 'WPMU_PLUGIN_DIR' ) && is_dir( WPMU_PLUGIN_DIR ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $info['wp-filesystem']['fields']['mu_plugin_directory'] = array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $is_writable_wpmu_plugin_dir = wp_is_writable( WPMU_PLUGIN_DIR );
+
+ $info['wp-filesystem']['fields']['mu-plugins'] = array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'label' => __( 'The must use plugins directory' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'value' => ( wp_is_writable( WPMU_PLUGIN_DIR ) ? __( 'Writable' ) : __( 'Not writable' ) ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'value' => ( $is_writable_wpmu_plugin_dir ? __( 'Writable' ) : __( 'Not writable' ) ),
+ 'debug' => ( $is_writable_wpmu_plugin_dir ? 'writable' : 'not writable' ),
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Add or modify new debug sections.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Add or modify the debug information.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Plugin or themes may wish to introduce their own debug information without creating additional admin pages for this
- * kind of information as it is rarely needed, they can then utilize this filter to introduce their own sections.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Plugin or themes may wish to introduce their own debug information without creating additional admin pages
+ * they can utilize this filter to introduce their own sections or add more data to existing sections.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Array keys added by core are all prefixed with `wp-`, plugins and themes are encouraged to use their own slug as
- * a prefix, both for consistency as well as avoiding key collisions.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Array keys for sections added by core are all prefixed with `wp-`, plugins and themes should use their own slug as
+ * a prefix, both for consistency as well as avoiding key collisions. Note that the array keys are used as labels
+ * for the copied data.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 5.2.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -863,6 +1067,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $args {
</span><span class="cx" style="display: block; padding: 0 10px"> * The debug information to be added to the core information page.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * This is an associative multi-dimensional array, up to three levels deep. The topmost array holds the sections.
+ * Each section has a `$fields` associative array (see below), and each `$value` in `$fields` can be
+ * another associative array of name/value pairs when there is more structured data to display.
+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @type string $label The title for this section of the debug output.
</span><span class="cx" style="display: block; padding: 0 10px"> * @type string $description Optional. A description for your information section which may contain basic HTML
</span><span class="cx" style="display: block; padding: 0 10px"> * markup: `em`, `strong` and `a` for linking to documentation or putting emphasis.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -869,26 +1077,23 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @type boolean $show_count Optional. If set to `true` the amount of fields will be included in the title for
</span><span class="cx" style="display: block; padding: 0 10px"> * this section.
</span><span class="cx" style="display: block; padding: 0 10px"> * @type boolean $private Optional. If set to `true` the section and all associated fields will be excluded
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * from the copy-paste text area.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * from the copied data.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @type array $fields {
</span><span class="cx" style="display: block; padding: 0 10px"> * An associative array containing the data to be displayed.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @type string $label The label for this piece of information.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @type string $value The output that is of interest for this field.
- * @type boolean $private Optional. If set to `true` the field will not be included in the copy-paste text area
- * on top of the page, allowing you to show, for example, API keys here.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @type string $value The output that is displayed for this field. Text should be translated. Can be
+ * an associative array that is displayed as name/value pairs.
+ * @type string $debug Optional. The output that is used for this field when the user copies the data.
+ * It should be more concise and not translated. If not set, the content of `$value` is used.
+ * Note that the array keys are used as labels for the copied data.
+ * @type boolean $private Optional. If set to `true` the field will not be included in the copied data
+ * allowing you to show, for example, API keys here.
</ins><span class="cx" style="display: block; padding: 0 10px"> * }
</span><span class="cx" style="display: block; padding: 0 10px"> * }
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> $info = apply_filters( 'debug_information', $info );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! empty( $locale ) ) {
- // Change the language used for translations
- if ( $switched_locale ) {
- restore_previous_locale();
- }
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> return $info;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -898,10 +1103,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 5.2.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $info_array Information gathered from the `WP_Debug_Data::debug_data` function.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $type Optional. The data type to format the information as. Default 'text'.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $type The data type to return, either 'info' or 'debug'.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return string The formatted data.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function format( $info_array, $type = 'text' ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function format( $info_array, $type ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $return = "`\n";
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $info_array as $section => $details ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -910,36 +1115,49 @@
</span><span class="cx" style="display: block; padding: 0 10px"> continue;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $section_label = 'debug' === $type ? $section : $details['label'];
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $return .= sprintf(
</span><span class="cx" style="display: block; padding: 0 10px"> "### %s%s ###\n\n",
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $details['label'],
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $section_label,
</ins><span class="cx" style="display: block; padding: 0 10px"> ( isset( $details['show_count'] ) && $details['show_count'] ? sprintf( ' (%d)', count( $details['fields'] ) ) : '' )
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- foreach ( $details['fields'] as $field ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ foreach ( $details['fields'] as $field_name => $field ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $field['private'] ) && true === $field['private'] ) {
</span><span class="cx" style="display: block; padding: 0 10px"> continue;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $values = $field['value'];
- if ( is_array( $field['value'] ) ) {
- $values = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 'debug' === $type && isset( $field['debug'] ) ) {
+ $debug_data = $field['debug'];
+ } else {
+ $debug_data = $field['value'];
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Can be array, one level deep only.
+ if ( is_array( $debug_data ) ) {
+ $value = '';
+
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ( $field['value'] as $name => $value ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $values .= sprintf(
- "\n\t%s: %s",
- $name,
- $value
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $value .= sprintf( "\n\t%s: %s", $name, $value );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } elseif ( is_bool( $debug_data ) ) {
+ $value = $debug_data ? 'true' : 'false';
+ } elseif ( empty( $debug_data ) && '0' !== $debug_data ) {
+ $value = 'undefined';
+ } else {
+ $value = $debug_data;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $return .= sprintf(
- "%s: %s\n",
- $field['label'],
- $values
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 'debug' === $type ) {
+ $label = $field_name;
+ } else {
+ $label = $field['label'];
+ }
+
+ $return .= sprintf( "%s: %s\n", $label, $value );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> $return .= "\n";
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcwpadminsitehealthinfophp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/site-health-info.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/site-health-info.php 2019-04-09 15:23:20 UTC (rev 45155)
+++ trunk/src/wp-admin/site-health-info.php 2019-04-10 05:06:54 UTC (rev 45156)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -66,11 +66,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px"> WP_Debug_Data::check_for_updates();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $info = WP_Debug_Data::debug_data();
- $english_info = '';
- if ( 0 !== strpos( get_user_locale(), 'en' ) ) {
- $english_info = WP_Debug_Data::debug_data( 'en_US' );
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $info = WP_Debug_Data::debug_data();
+
</ins><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <h2>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -86,15 +83,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <div class="site-health-copy-buttons">
</span><span class="cx" style="display: block; padding: 0 10px"> <div class="copy-button-wrapper">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <button type="button" class="button button-primary copy-button" data-clipboard-text="<?php echo esc_attr( WP_Debug_Data::format( $info, 'text' ) ); ?>"><?php _e( 'Copy site info to clipboard' ); ?></button>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <button type="button" class="button copy-button" data-clipboard-text="<?php echo esc_attr( WP_Debug_Data::format( $info, 'debug' ) ); ?>">
+ <?php _e( 'Copy site info to clipboard' ); ?>
+ </button>
</ins><span class="cx" style="display: block; padding: 0 10px"> <span class="success" aria-hidden="true"><?php _e( 'Copied!' ); ?></span>
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <?php if ( $english_info ) : ?>
- <div class="copy-button-wrapper">
- <button type="button" class="button copy-button" data-clipboard-text="<?php echo esc_attr( WP_Debug_Data::format( $english_info, 'text' ) ); ?>"><?php _e( 'Copy site info to clipboard (English)' ); ?></button>
- <span class="success" aria-hidden="true"><?php _e( 'Copied!' ); ?></span>
- </div>
- <?php endif; ?>
</del><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <div id="health-check-debug" class="health-check-accordion">
</span></span></pre>
</div>
</div>
</body>
</html>