Skip to content

Commit 90310e4

Browse files
authored
Merge pull request #272 from WordPress/update-site-health-reports-copy
Update Site Health reports copy for more clarity and consistency
2 parents 5b3c058 + fbdf7cd commit 90310e4

4 files changed

Lines changed: 41 additions & 103 deletions

File tree

‎modules/object-cache/persistent-object-cache-health-check/load.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function perflab_oc_health_persistent_object_cache() {
5959
'label' => __( 'A persistent object cache is being used', 'performance-lab' ),
6060
'description' => sprintf(
6161
'<p>%s</p>',
62-
__( "WordPress performs at its best when a persistent object cache is used. A persistent object cache helps to reduce load on your SQL server significantly and allows WordPress to retrieve your site's content and settings much faster.", 'performance-lab' )
62+
__( "A persistent object cache makes your site's database more efficient, resulting in faster load times because WordPress can retrieve your site's content and settings much more quickly.", 'performance-lab' )
6363
),
6464
'actions' => sprintf(
6565
'<p><a href="%s" target="_blank" rel="noopener">%s <span class="screen-reader-text">%s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
@@ -82,7 +82,7 @@ function perflab_oc_health_persistent_object_cache() {
8282

8383
$available_services = perflab_oc_health_available_object_cache_services();
8484

85-
$notes = __( 'Speak to your web host about what persistent object caches are available and how to enable them.', 'performance-lab' );
85+
$notes = __( 'Your hosting provider can tell you if persistent object caches are able to be enabled on your site.', 'performance-lab' );
8686

8787
if ( ! empty( $available_services ) ) {
8888
$notes .= ' ' . sprintf(

‎modules/site-health/audit-autoloaded-options/load.php‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,18 @@ function perflab_aao_autoloaded_options_test() {
3737
$autoloaded_options_size = perflab_aao_autoloaded_options_size();
3838
$autoloaded_options_count = count( wp_load_alloptions() );
3939

40+
$base_description = __( 'Autoloaded options are configuration settings for plugins and themes that are automatically loaded with every page load in WordPress. Having too many autoloaded options can slow down your site.', 'performance-lab' );
41+
4042
$result = array(
41-
'label' => esc_html__( 'Autoloaded options', 'performance-lab' ),
43+
'label' => esc_html__( 'Autoloaded options are acceptable', 'performance-lab' ),
4244
'status' => 'good',
4345
'badge' => array(
4446
'label' => esc_html__( 'Performance', 'performance-lab' ),
4547
'color' => 'blue',
4648
),
4749
'description' => sprintf(
48-
/* translators: 1: Number of autoloaded options. 2.Autoloaded options size. */
49-
'<p>' . esc_html__( 'The amount of %1$s autoloaded options (size: %2$s) in options table is acceptable.', 'performance-lab' ) . '</p>',
50+
/* translators: 1. Number of autoloaded options. 2. Autoloaded options size. */
51+
'<p>' . esc_html( $base_description ) . ' ' . esc_html__( 'Your site has %1$s autoloaded options (size: %2$s) in the options table, which is acceptable.', 'performance-lab' ) . '</p>',
5052
$autoloaded_options_count,
5153
size_format( $autoloaded_options_size )
5254
),
@@ -69,9 +71,10 @@ function perflab_aao_autoloaded_options_test() {
6971

7072
$result['status'] = 'critical';
7173
$result['badge']['color'] = 'red';
74+
$result['label'] = esc_html__( 'Autoloaded options could affect performance', 'performance-lab' );
7275
$result['description'] = sprintf(
73-
/* translators: 1: Number of autoloaded options. 2.Autoloaded options size. */
74-
'<p>' . esc_html__( 'Your website uses %1$s autoloaded options (size: %2$s). Try to reduce the number of autoloaded options or performance will be affected.', 'performance-lab' ) . '</p>',
76+
/* translators: 1. Number of autoloaded options. 2. Autoloaded options size. */
77+
'<p>' . esc_html( $base_description ) . ' ' . esc_html__( 'Your site has %1$s autoloaded options (size: %2$s) in the options table, which could cause your site to be slow. You can reduce the number of autoloaded options by cleaning up your site\'s options table.', 'performance-lab' ) . '</p>',
7578
$autoloaded_options_count,
7679
size_format( $autoloaded_options_size )
7780
);

‎modules/site-health/webp-support/load.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function webp_uploads_check_webp_supported_test() {
4242
),
4343
'description' => sprintf(
4444
'<p>%s</p>',
45-
__( 'WebP image format is used by WordPress to improve the performance of your site by generating smaller images than it usually could with the JPEG format. This means your pages will load faster and consume less bandwidth.', 'performance-lab' )
45+
__( 'The WebP image format produces images that are usually smaller in size than JPEG images, which can reduce page load time and consume less bandwidth.', 'performance-lab' )
4646
),
4747
'actions' => '',
4848
'test' => 'is_webp_uploads_enabled',
@@ -56,7 +56,7 @@ function webp_uploads_check_webp_supported_test() {
5656
$result['actions'] = sprintf(
5757
'<p>%s</p>',
5858
/* translators: Accessibility text. */
59-
__( 'Please contact your host and ask them to add WebP support.', 'performance-lab' )
59+
__( 'WebP support can only be enabled by your hosting provider, so contact them for more information.', 'performance-lab' )
6060
);
6161
}
6262

‎tests/modules/site-health/audit-autoloaded-options/audit-autoloaded-options-test.php‎

Lines changed: 29 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,48 @@ class Audit_Autoloaded_Options_Tests extends WP_UnitTestCase {
1010
const AUTOLOADED_OPTION_KEY = 'test_set_autoloaded_option';
1111

1212
/**
13-
* @dataProvider provider_added_test_info_site_health
14-
*
1513
* Tests perflab_aao_add_autoloaded_options_test()
1614
*/
17-
public function test_perflab_aao_add_autoloaded_options_test( $provider_added_test_info_site_health ) {
18-
$this->assertEqualSets( $provider_added_test_info_site_health, perflab_aao_add_autoloaded_options_test( array() ) );
15+
public function test_perflab_aao_add_autoloaded_options_test() {
16+
$expected_test = array(
17+
'label' => esc_html__( 'Autoloaded options', 'performance-lab' ),
18+
'test' => 'perflab_aao_autoloaded_options_test',
19+
);
20+
21+
$this->assertEquals(
22+
array(
23+
'direct' => array(
24+
'autoloaded_options' => $expected_test,
25+
),
26+
),
27+
perflab_aao_add_autoloaded_options_test( array() )
28+
);
1929
}
2030

2131
/**
22-
* @dataProvider provider_autoloaded_options_less_than_limit
23-
*
2432
* Tests perflab_aao_autoloaded_options_test() when autoloaded options less than warning size.
2533
*/
26-
public function test_perflab_aao_autoloaded_options_test_no_warning( $provider_autoloaded_options_less_than_limit ) {
27-
$this->assertEqualSets(
28-
perflab_aao_autoloaded_options_test(),
29-
$provider_autoloaded_options_less_than_limit
30-
);
34+
public function test_perflab_aao_autoloaded_options_test_no_warning() {
35+
$expected_label = esc_html__( 'Autoloaded options are acceptable', 'performance-lab' );
36+
$expected_status = 'good';
37+
38+
$result = perflab_aao_autoloaded_options_test();
39+
$this->assertSame( $expected_label, $result['label'] );
40+
$this->assertSame( $expected_status, $result['status'] );
3141
}
3242

3343
/**
34-
* @dataProvider provider_autoloaded_options_bigger_than_limit
35-
*
3644
* Tests perflab_aao_autoloaded_options_test() when autoloaded options more than warning size.
3745
*/
38-
public function test_perflab_aao_autoloaded_options_test_warning( $provider_autoloaded_options_bigger_than_limit ) {
46+
public function test_perflab_aao_autoloaded_options_test_warning() {
3947
self::set_autoloaded_option( self::WARNING_AUTOLOADED_SIZE_LIMIT_IN_BYTES );
40-
$this->assertEqualSets(
41-
perflab_aao_autoloaded_options_test(),
42-
$provider_autoloaded_options_bigger_than_limit
43-
);
48+
49+
$expected_label = esc_html__( 'Autoloaded options could affect performance', 'performance-lab' );
50+
$expected_status = 'critical';
51+
52+
$result = perflab_aao_autoloaded_options_test();
53+
$this->assertSame( $expected_label, $result['label'] );
54+
$this->assertSame( $expected_status, $result['status'] );
4455
}
4556

4657
/**
@@ -74,81 +85,5 @@ public static function set_autoloaded_option( $bytes = 800000 ) {
7485
public static function delete_autoloaded_option() {
7586
delete_option( self::AUTOLOADED_OPTION_KEY );
7687
}
77-
78-
/**
79-
* This is the information we are adding into site_status_tests hook.
80-
*
81-
* @return array
82-
*/
83-
public function provider_added_test_info_site_health() {
84-
$added_tests = array();
85-
$added_tests['direct']['autoloaded_options'] = array(
86-
'label' => esc_html__( 'Autoloaded options', 'performance-lab' ),
87-
'test' => 'perflab_aao_autoloaded_options_test',
88-
);
89-
return array( array( $added_tests ) );
90-
}
91-
92-
/**
93-
* Data provider for perflab_aao_autoloaded_options_test if autoloaded options are less than the limit.
94-
*
95-
* @return array
96-
*/
97-
public function provider_autoloaded_options_less_than_limit() {
98-
$autoloaded_options_size = perflab_aao_autoloaded_options_size();
99-
$autoloaded_options_count = count( wp_load_alloptions() );
100-
101-
$result = array(
102-
'label' => esc_html__( 'Autoloaded options', 'performance-lab' ),
103-
'status' => 'good',
104-
'badge' => array(
105-
'label' => esc_html__( 'Performance', 'performance-lab' ),
106-
'color' => 'blue',
107-
),
108-
'description' => sprintf(
109-
/* translators: 1: Number of autoloaded options. 2.Autoloaded options size. */
110-
'<p>' . esc_html__( 'The amount of %1$s autoloaded options (size: %2$s) in options table is acceptable.', 'performance-lab' ) . '</p>',
111-
$autoloaded_options_count,
112-
size_format( $autoloaded_options_size )
113-
),
114-
'actions' => '',
115-
'test' => 'autoloaded_options',
116-
);
117-
return array( array( $result ) );
118-
}
119-
120-
/**
121-
* Data provider for perflab_aao_autoloaded_options_test if autoloaded options are more than the limit.
122-
*
123-
* @return array
124-
*/
125-
public function provider_autoloaded_options_bigger_than_limit() {
126-
$result = perflab_aao_autoloaded_options_test();
127-
128-
self::set_autoloaded_option( self::WARNING_AUTOLOADED_SIZE_LIMIT_IN_BYTES );
129-
$autoloaded_options_size = perflab_aao_autoloaded_options_size();
130-
$autoloaded_options_count = count( wp_load_alloptions() );
131-
self::delete_autoloaded_option();
132-
133-
$result['status'] = 'critical';
134-
$result['badge']['color'] = 'red';
135-
$result['description'] = sprintf(
136-
/* translators: 1: Number of autoloaded options. 2.Autoloaded options size. */
137-
'<p>' . esc_html__( 'Your website uses %1$s autoloaded options (size: %2$s). Try to reduce the number of autoloaded options or performance will be affected.', 'performance-lab' ) . '</p>',
138-
$autoloaded_options_count,
139-
size_format( $autoloaded_options_size )
140-
);
141-
142-
$result['actions'] = sprintf(
143-
/* translators: 1: HelpHub URL. 2: Link description. */
144-
'<p><a target="_blank" href="%1$s">%2$s</a></p>',
145-
esc_url( __( 'https://wordpress.org/support/article/optimization/', 'performance-lab' ) ),
146-
esc_html__( 'More info about performance optimization', 'performance-lab' )
147-
);
148-
149-
return array( array( $result ) );
150-
}
151-
152-
15388
}
15489

0 commit comments

Comments
 (0)