Skip to content

Commit cdba6cb

Browse files
authored
Merge branch 'WordPress:trunk' into trunk
2 parents 62e72b3 + 39617d8 commit cdba6cb

File tree

30 files changed

+1585
-186
lines changed

30 files changed

+1585
-186
lines changed

src/js/_enqueues/admin/site-health.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jQuery( function( $ ) {
1515
isStatusTab = $( '.health-check-body.health-check-status-tab' ).length,
1616
isDebugTab = $( '.health-check-body.health-check-debug-tab' ).length,
1717
pathsSizesSection = $( '#health-check-accordion-block-wp-paths-sizes' ),
18+
menuCounterWrapper = $( '#adminmenu .site-health-counter' ),
19+
menuCounter = $( '#adminmenu .site-health-counter .count' ),
1820
successTimeout;
1921

2022
// Debug information copy section.
@@ -164,8 +166,14 @@ jQuery( function( $ ) {
164166
$( '.site-health-issue-count-title', issueWrapper ).html( heading );
165167
}
166168

169+
menuCounter.text( SiteHealth.site_status.issues.critical );
170+
167171
if ( 0 < parseInt( SiteHealth.site_status.issues.critical, 0 ) ) {
168172
$( '#health-check-issues-critical' ).removeClass( 'hidden' );
173+
174+
menuCounterWrapper.removeClass( 'count-0' );
175+
} else {
176+
menuCounterWrapper.addClass( 'count-0' );
169177
}
170178
if ( 0 < parseInt( SiteHealth.site_status.issues.recommended, 0 ) ) {
171179
$( '#health-check-issues-recommended' ).removeClass( 'hidden' );

src/wp-admin/css/admin-menu.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ ul#adminmenu > li.current > a.current:after {
427427
}
428428

429429
/* @todo: consider to use a single rule for these counters and the list table comments counters. */
430+
#adminmenu .menu-counter,
430431
#adminmenu .awaiting-mod,
431432
#adminmenu .update-plugins {
432433
display: inline-block;

src/wp-admin/css/colors/_admin.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ ul#adminmenu > li.current > a.current:after {
350350

351351
/* Admin Menu: bubble */
352352

353+
#adminmenu .menu-counter,
353354
#adminmenu .awaiting-mod,
354355
#adminmenu .update-plugins {
355356
color: $menu-bubble-text;

src/wp-admin/css/dashboard.css

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,7 +1186,8 @@ a.rsswidget {
11861186
padding-right: 6px;
11871187
}
11881188

1189-
#dashboard_php_nag.php-insecure .dashicons-warning {
1189+
#dashboard_php_nag.php-no-security-updates .dashicons-warning,
1190+
#dashboard_php_nag.php-version-lower-than-future-minimum .dashicons-warning {
11901191
color: #d63638;
11911192
}
11921193

@@ -1198,14 +1199,15 @@ a.rsswidget {
11981199
margin: 12px 0;
11991200
}
12001201

1201-
#dashboard_php_nag h3 {
1202-
font-weight: 600;
1203-
}
1204-
12051202
#dashboard_php_nag .button .dashicons-external {
12061203
line-height: 25px;
12071204
}
12081205

1206+
.bigger-bolder-text {
1207+
font-weight: 600;
1208+
font-size: 14px;
1209+
}
1210+
12091211
/* =Media Queries
12101212
-------------------------------------------------------------- */
12111213

src/wp-admin/includes/class-wp-site-health.php

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ public function get_test_php_version() {
741741
'<p>%s</p>',
742742
sprintf(
743743
/* translators: %s: The minimum recommended PHP version. */
744-
__( 'PHP is the programming language used to build and maintain WordPress. Newer versions of PHP are created with increased performance in mind, so you may see a positive effect on your site&#8217;s performance. The minimum recommended version of PHP is %s.' ),
744+
__( 'PHP is one of the programming languages used to build WordPress. Newer versions of PHP receive regular security updates and may increase your site&#8217;s performance. The minimum recommended version of PHP is %s.' ),
745745
$response ? $response['recommended_version'] : ''
746746
)
747747
),
@@ -764,33 +764,62 @@ public function get_test_php_version() {
764764
if ( $response['is_supported'] ) {
765765
$result['label'] = sprintf(
766766
/* translators: %s: The server PHP version. */
767-
__( 'Your site is running an older version of PHP (%s)' ),
767+
__( 'Your site is running on an older version of PHP (%s)' ),
768768
PHP_VERSION
769769
);
770770
$result['status'] = 'recommended';
771771

772772
return $result;
773773
}
774774

775+
// The PHP version is still receiving security fixes, but is lower than
776+
// the expected minimum version that will be required by WordPress in the near future.
777+
if ( $response['is_secure'] && $response['is_lower_than_future_minimum'] ) {
778+
// The `is_secure` array key name doesn't actually imply this is a secure version of PHP. It only means it receives security updates.
779+
780+
$result['label'] = sprintf(
781+
/* translators: %s: The server PHP version. */
782+
__( 'Your site is running on an outdated version of PHP (%s), which soon will not be supported by WordPress.' ),
783+
PHP_VERSION
784+
);
785+
786+
$result['status'] = 'critical';
787+
$result['badge']['label'] = __( 'Requirements' );
788+
789+
return $result;
790+
}
791+
775792
// The PHP version is only receiving security fixes.
776793
if ( $response['is_secure'] ) {
777794
$result['label'] = sprintf(
778795
/* translators: %s: The server PHP version. */
779-
__( 'Your site is running an older version of PHP (%s), which should be updated' ),
796+
__( 'Your site is running on an older version of PHP (%s), which should be updated' ),
780797
PHP_VERSION
781798
);
782799
$result['status'] = 'recommended';
783800

784801
return $result;
785802
}
786803

787-
// Anything no longer secure must be updated.
788-
$result['label'] = sprintf(
789-
/* translators: %s: The server PHP version. */
790-
__( 'Your site is running an outdated version of PHP (%s), which requires an update' ),
791-
PHP_VERSION
792-
);
793-
$result['status'] = 'critical';
804+
// No more security updates for the PHP version, and lower than the expected minimum version required by WordPress.
805+
if ( $response['is_lower_than_future_minimum'] ) {
806+
$message = sprintf(
807+
/* translators: %s: The server PHP version. */
808+
__( 'Your site is running on an outdated version of PHP (%s), which does not receive security updates and soon will not be supported by WordPress.' ),
809+
PHP_VERSION
810+
);
811+
} else {
812+
// No more security updates for the PHP version, must be updated.
813+
$message = sprintf(
814+
/* translators: %s: The server PHP version. */
815+
__( 'Your site is running on an outdated version of PHP (%s), which does not receive security updates. It should be updated.' ),
816+
PHP_VERSION
817+
);
818+
}
819+
820+
$result['label'] = $message;
821+
$result['status'] = 'critical';
822+
794823
$result['badge']['label'] = __( 'Security' );
795824

796825
return $result;

src/wp-admin/includes/dashboard.php

Lines changed: 55 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,38 @@
2020
function wp_dashboard_setup() {
2121
global $wp_registered_widgets, $wp_registered_widget_controls, $wp_dashboard_control_callbacks;
2222

23-
$wp_dashboard_control_callbacks = array();
24-
$screen = get_current_screen();
23+
$screen = get_current_screen();
2524

2625
/* Register Widgets and Controls */
26+
$wp_dashboard_control_callbacks = array();
2727

28-
$response = wp_check_browser_version();
28+
// Browser version
29+
$check_browser = wp_check_browser_version();
2930

30-
if ( $response && $response['upgrade'] ) {
31+
if ( $check_browser && $check_browser['upgrade'] ) {
3132
add_filter( 'postbox_classes_dashboard_dashboard_browser_nag', 'dashboard_browser_nag_class' );
3233

33-
if ( $response['insecure'] ) {
34+
if ( $check_browser['insecure'] ) {
3435
wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'You are using an insecure browser!' ), 'wp_dashboard_browser_nag' );
3536
} else {
3637
wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'Your browser is out of date!' ), 'wp_dashboard_browser_nag' );
3738
}
3839
}
3940

4041
// PHP Version.
41-
$response = wp_check_php_version();
42+
$check_php = wp_check_php_version();
4243

43-
if ( $response && isset( $response['is_acceptable'] ) && ! $response['is_acceptable']
44-
&& current_user_can( 'update_php' )
45-
) {
46-
add_filter( 'postbox_classes_dashboard_dashboard_php_nag', 'dashboard_php_nag_class' );
44+
if ( $check_php && current_user_can( 'update_php' ) ) {
45+
// If "not acceptable" the widget will be shown.
46+
if ( isset( $check_php['is_acceptable'] ) && ! $check_php['is_acceptable'] ) {
47+
add_filter( 'postbox_classes_dashboard_dashboard_php_nag', 'dashboard_php_nag_class' );
4748

48-
wp_add_dashboard_widget( 'dashboard_php_nag', __( 'PHP Update Recommended' ), 'wp_dashboard_php_nag' );
49+
if ( $check_php['is_lower_than_future_minimum'] ) {
50+
wp_add_dashboard_widget( 'dashboard_php_nag', __( 'PHP Update Required' ), 'wp_dashboard_php_nag' );
51+
} else {
52+
wp_add_dashboard_widget( 'dashboard_php_nag', __( 'PHP Update Recommended' ), 'wp_dashboard_php_nag' );
53+
}
54+
}
4955
}
5056

5157
// Site Health.
@@ -1825,29 +1831,48 @@ function wp_dashboard_php_nag() {
18251831
}
18261832

18271833
if ( isset( $response['is_secure'] ) && ! $response['is_secure'] ) {
1828-
$msg = sprintf(
1834+
// The `is_secure` array key name doesn't actually imply this is a secure version of PHP. It only means it receives security updates.
1835+
1836+
if ( $response['is_lower_than_future_minimum'] ) {
1837+
$message = sprintf(
1838+
/* translators: %s: The server PHP version. */
1839+
__( 'Your site is running on an outdated version of PHP (%s), which does not receive security updates and soon will not be supported by WordPress. Ensure that PHP is updated on your server as soon as possible. Otherwise you will not be able to upgrade WordPress.' ),
1840+
PHP_VERSION
1841+
);
1842+
} else {
1843+
$message = sprintf(
1844+
/* translators: %s: The server PHP version. */
1845+
__( 'Your site is running on an outdated version of PHP (%s), which does not receive security updates. It should be updated.' ),
1846+
PHP_VERSION
1847+
);
1848+
}
1849+
} elseif ( $response['is_lower_than_future_minimum'] ) {
1850+
$message = sprintf(
18291851
/* translators: %s: The server PHP version. */
1830-
__( 'Your site is running an insecure version of PHP (%s), which should be updated.' ),
1852+
__( 'Your site is running on an outdated version of PHP (%s), which soon will not be supported by WordPress. Ensure that PHP is updated on your server as soon as possible. Otherwise you will not be able to upgrade WordPress.' ),
18311853
PHP_VERSION
18321854
);
18331855
} else {
1834-
$msg = sprintf(
1856+
$message = sprintf(
18351857
/* translators: %s: The server PHP version. */
1836-
__( 'Your site is running an outdated version of PHP (%s), which should be updated.' ),
1858+
__( 'Your site is running on an outdated version of PHP (%s), which should be updated.' ),
18371859
PHP_VERSION
18381860
);
18391861
}
18401862
?>
1841-
<p><?php echo $msg; ?></p>
1863+
<p class="bigger-bolder-text"><?php echo $message; ?></p>
18421864

1843-
<h3><?php _e( 'What is PHP and how does it affect my site?' ); ?></h3>
1865+
<p><?php _e( 'What is PHP and how does it affect my site?' ); ?></p>
18441866
<p>
1867+
<?php _e( 'PHP is one of the programming languages used to build WordPress. Newer versions of PHP receive regular security updates and may increase your site&#8217;s performance.' ); ?>
18451868
<?php
1846-
printf(
1847-
/* translators: %s: The minimum recommended PHP version. */
1848-
__( 'PHP is the programming language used to build and maintain WordPress. Newer versions of PHP are created with increased performance in mind, so you may see a positive effect on your site&#8217;s performance. The minimum recommended version of PHP is %s.' ),
1849-
$response ? $response['recommended_version'] : ''
1850-
);
1869+
if ( ! empty( $response['recommended_version'] ) ) {
1870+
printf(
1871+
/* translators: %s: The minimum recommended PHP version. */
1872+
__( 'The minimum recommended version of PHP is %s.' ),
1873+
$response['recommended_version']
1874+
);
1875+
}
18511876
?>
18521877
</p>
18531878

@@ -1879,8 +1904,14 @@ function wp_dashboard_php_nag() {
18791904
function dashboard_php_nag_class( $classes ) {
18801905
$response = wp_check_php_version();
18811906

1882-
if ( $response && isset( $response['is_secure'] ) && ! $response['is_secure'] ) {
1883-
$classes[] = 'php-insecure';
1907+
if ( ! $response ) {
1908+
return $classes;
1909+
}
1910+
1911+
if ( isset( $response['is_secure'] ) && ! $response['is_secure'] ) {
1912+
$classes[] = 'php-no-security-updates';
1913+
} elseif ( $response['is_lower_than_future_minimum'] ) {
1914+
$classes[] = 'php-version-lower-than-future-minimum';
18841915
}
18851916

18861917
return $classes;

src/wp-admin/includes/misc.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1585,7 +1585,8 @@ function wp_check_php_version() {
15851585
* 'recommended_version' - string - The PHP version recommended by WordPress.
15861586
* 'is_supported' - boolean - Whether the PHP version is actively supported.
15871587
* 'is_secure' - boolean - Whether the PHP version receives security updates.
1588-
* 'is_acceptable' - boolean - Whether the PHP version is still acceptable for WordPress.
1588+
* 'is_acceptable' - boolean - Whether the PHP version is still acceptable or warnings
1589+
* should be shown and an update recommended.
15891590
*/
15901591
$response = json_decode( wp_remote_retrieve_body( $response ), true );
15911592

@@ -1613,5 +1614,15 @@ function wp_check_php_version() {
16131614
$response['is_acceptable'] = (bool) apply_filters( 'wp_is_php_version_acceptable', true, $version );
16141615
}
16151616

1617+
$response['is_lower_than_future_minimum'] = false;
1618+
1619+
// The minimum supported PHP version will be updated to 7.2. Check if the current version is lower.
1620+
if ( version_compare( $version, '7.2', '<' ) ) {
1621+
$response['is_lower_than_future_minimum'] = true;
1622+
1623+
// Force showing of warnings.
1624+
$response['is_acceptable'] = false;
1625+
}
1626+
16161627
return $response;
16171628
}

src/wp-admin/menu.php

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,11 +342,37 @@ function _add_plugin_file_editor_to_tools() {
342342
}
343343
}
344344

345+
$site_health_count = '';
346+
if ( ! is_multisite() && current_user_can( 'view_site_health_checks' ) ) {
347+
$get_issues = get_transient( 'health-check-site-status-result' );
348+
349+
$issue_counts = array();
350+
351+
if ( false !== $get_issues ) {
352+
$issue_counts = json_decode( $get_issues, true );
353+
}
354+
355+
if ( ! is_array( $issue_counts ) || ! $issue_counts ) {
356+
$issue_counts = array(
357+
'good' => 0,
358+
'recommended' => 0,
359+
'critical' => 0,
360+
);
361+
}
362+
363+
$site_health_count = sprintf(
364+
'<span class="menu-counter site-health-counter count-%s"><span class="count">%s</span></span>',
365+
$issue_counts['critical'],
366+
number_format_i18n( $issue_counts['critical'] )
367+
);
368+
}
369+
345370
$menu[75] = array( __( 'Tools' ), 'edit_posts', 'tools.php', '', 'menu-top menu-icon-tools', 'menu-tools', 'dashicons-admin-tools' );
346371
$submenu['tools.php'][5] = array( __( 'Available Tools' ), 'edit_posts', 'tools.php' );
347372
$submenu['tools.php'][10] = array( __( 'Import' ), 'import', 'import.php' );
348373
$submenu['tools.php'][15] = array( __( 'Export' ), 'export', 'export.php' );
349-
$submenu['tools.php'][20] = array( __( 'Site Health' ), 'view_site_health_checks', 'site-health.php' );
374+
/* translators: %s: Number of critical Site Health checks. */
375+
$submenu['tools.php'][20] = array( sprintf( __( 'Site Health %s' ), $site_health_count ), 'view_site_health_checks', 'site-health.php' );
350376
$submenu['tools.php'][25] = array( __( 'Export Personal Data' ), 'export_others_personal_data', 'export-personal-data.php' );
351377
$submenu['tools.php'][30] = array( __( 'Erase Personal Data' ), 'erase_others_personal_data', 'erase-personal-data.php' );
352378
if ( is_multisite() && ! is_main_site() ) {

src/wp-content/themes/twentytwenty/assets/css/editor-style-block-rtl.css

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -765,8 +765,7 @@ hr.wp-block-separator.is-style-dots::before {
765765
.wp-block-cover-image .wp-block-cover-text,
766766
.wp-block-cover-image h2,
767767
.wp-block-cover .wp-block-cover-image-text,
768-
.wp-block-cover .wp-block-cover-text,
769-
.wp-block-cover h2 {
768+
.wp-block-cover .wp-block-cover-text {
770769
max-width: 100%;
771770
}
772771

@@ -1027,7 +1026,7 @@ hr.wp-block-separator.is-style-dots::before {
10271026
border-style: solid;
10281027
border-width: 2px 0 0;
10291028
line-height: 1.25;
1030-
margin: 20px 0 16px 16px;
1029+
margin: 20px 0 16px 10px;
10311030
padding-top: 12px;
10321031
}
10331032

src/wp-content/themes/twentytwenty/assets/css/editor-style-block.css

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -769,8 +769,7 @@ hr.wp-block-separator.is-style-dots::before {
769769
.wp-block-cover-image .wp-block-cover-text,
770770
.wp-block-cover-image h2,
771771
.wp-block-cover .wp-block-cover-image-text,
772-
.wp-block-cover .wp-block-cover-text,
773-
.wp-block-cover h2 {
772+
.wp-block-cover .wp-block-cover-text {
774773
max-width: 100%;
775774
}
776775

@@ -1031,7 +1030,7 @@ hr.wp-block-separator.is-style-dots::before {
10311030
border-style: solid;
10321031
border-width: 2px 0 0;
10331032
line-height: 1.25;
1034-
margin: 20px 16px 16px 0;
1033+
margin: 20px 10px 16px 0;
10351034
padding-top: 12px;
10361035
}
10371036

0 commit comments

Comments
 (0)