diff --git a/_inc/lib/debugger/class-jetpack-cxn-test-base.php b/_inc/lib/debugger/class-jetpack-cxn-test-base.php index 2357fdb04321d..7f02515f8f698 100644 --- a/_inc/lib/debugger/class-jetpack-cxn-test-base.php +++ b/_inc/lib/debugger/class-jetpack-cxn-test-base.php @@ -318,7 +318,7 @@ public static function skipped_test( $args = array() ) { * - pass: bool|string True if the test passed. Default false. * - short_description: bool|string A brief, non-html description that will appear in CLI results, and as headings in admin UIs. Default 'Test failed!'. * - long_description: bool|string An html description that will appear in the site health page. Default false. - * - severity: bool|string 'critical', 'recommended', or 'good'. Default: false. + * - severity: bool|string 'critical', 'recommended', or 'good'. Default: 'critical'. * - action: bool|string A URL for the recommended action. Default: false. * - action_label: bool|string The label for the recommended action. Default: false. * - show_in_site_health: bool True if the test should be shown on the Site Health page. Default: true @@ -429,9 +429,9 @@ public function output_results_for_core_async_site_health() { } } else { $result['description'] .= sprintf( - '
%s
', - __( 'There was another problem:', 'jetpack' ) - ) . ' ' . $fail['message'] . ': ' . $fail['resolution']; + '%s
', + __( 'There was another problem:', 'jetpack' ) + ) . ' ' . $fail['message'] . ': ' . $fail['resolution']; if ( 'critical' === $fail['severity'] ) { // In case the initial failure is only "recommended". $result['status'] = 'critical'; } diff --git a/_inc/lib/debugger/class-jetpack-cxn-tests.php b/_inc/lib/debugger/class-jetpack-cxn-tests.php index f84356a64e8a9..379c3ecf633a0 100644 --- a/_inc/lib/debugger/class-jetpack-cxn-tests.php +++ b/_inc/lib/debugger/class-jetpack-cxn-tests.php @@ -494,6 +494,48 @@ protected function test__server_port_value() { } } + /** + * If Sync is enabled, this test will be skipped. If Sync is disabled, the test will fail. + * Eventually, we'll make this test more robust with additional states. Here is the plan for possible Sync states, + * including states that are planned but not yet implemented. + * + * Enabled: Skips test + * Disabled: Results in a failing test + * Healthy: @todo + * In Progress: @todo + * Delayed: @todo + * Error: @todo + */ + protected function test__sync_health() { + $name = __FUNCTION__; + if ( ! $this->helper_is_jetpack_connected() ) { + // If the site is not connected, there is no point in testing Sync health. + return self::skipped_test( array( 'name' => $name, 'show_in_site_health' => false ) ); + } + if ( Sync_Settings::is_sync_enabled() ) { + return self::skipped_test( array( 'name' => $name ) ); + } + return self::failing_test( array( + 'name' => $name, + 'label' => __( 'Jetpack Sync has been disabled on your site.', 'jetpack' ), + 'severity' => 'recommended', + 'action' => 'https://github.com/Automattic/jetpack/blob/master/packages/sync/src/class-settings.php', + 'action_label' => __( 'See Github for more on Sync Settings', 'jetpack' ), + 'short_description' => __( 'Jetpack Sync has been disabled on your site.', 'jetpack' ), + 'long_description' => sprintf( + '%1$s
' . + '%2$s
' . + '%3$s %4$s %5$s
', + __( 'The information synced by Jetpack ensures that Jetpack Search, Related Posts and other features are aligned with your site’s current content.', 'jetpack' ), + __( 'Developers may enable / disable syncing using the Sync Settings API.', 'jetpack' ), + /* translators: screen reader text indicating a test failed */ + __( 'Error', 'jetpack' ), + __( 'Jetpack Sync has been disabled on your site. Without it, certain Jetpack features will not work.', 'jetpack' ), + __( 'We recommend enabling Sync.', 'jetpack' ) + ) + ) ); + } + /** * Calls to WP.com to run the connection diagnostic testing suite. * diff --git a/_inc/lib/debugger/debug-functions.php b/_inc/lib/debugger/debug-functions.php index 9a945e536037b..4e2b3b26984f8 100644 --- a/_inc/lib/debugger/debug-functions.php +++ b/_inc/lib/debugger/debug-functions.php @@ -103,4 +103,3 @@ function jetpack_debugger_site_status_tests( $core_tests ) { return $core_tests; } -