• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Jetpack a2z

Jetpack a2z

Jetpack a2z

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / Jetpack_Cxn_Tests::test__sync_health() – Sync Health Tests.

You appear to be a bot. Output may be restricted

Description

Sync Health Tests.

Disabled: Results in a failing test (recommended) Delayed: Results in failing test (recommended) Error: Results in failing test (critical)

Usage

Jetpack_Cxn_Tests::test__sync_health();

Parameters

Returns

void

Source

File name: jetpack/_inc/lib/debugger/class-jetpack-cxn-tests.php


Lines:

1 to 100 of 142
  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,
        )
      );
    }

    // Sync is enabled.
    if ( Sync_Settings::is_sync_enabled() ) {

      if ( Sync_Health::get_status() === Sync_Health::STATUS_OUT_OF_SYNC ) {
        /*
				 * Sync has experienced Data Loss.
				 */
        $description  = '<p>';
        $description .= esc_html__( 'The information synced by Jetpack ensures that Jetpack Search, Related Posts and other features are aligned with your site’s current content.', 'jetpack' );
        $description .= '</p>';
        $description .= '<p>';
        $description .= sprintf(
          '<span class="dashicons fail"><span class="screen-reader-text">%1$s</span></span> ',
          esc_html__( 'Error', 'jetpack' )
        );
        $description .= wp_kses(
          __( 'Jetpack has detected that data is not properly in sync which may be impacting some of your site’s functionality. <strong>Click <a id="full_sync_request_link" href="#">here</a> to start a full sync</strong> to align Jetpack with your site data. If you still notice this error after running a full sync, please contact support for additional assistance.', 'jetpack' ),
          array(
            'a'      => array(
              'id'   => array(),
              'href' => array(),
            ),
            'strong' => array(),
          )
        );
        $description .= '</p>';

        return self::failing_test(
          array(
            'name'              => $name,
            'label'             => __( 'Jetpack has detected an error syncing your site.', 'jetpack' ),
            'severity'          => 'critical',
            'action'            => Redirect::get_url( 'jetpack-contact-support' ),
            'action_label'      => __( 'Contact Jetpack Support', 'jetpack' ),
            'short_description' => __( 'Jetpack has detected that data is not properly in sync which may be impacting some of your site’s functionality. We recommend a full sync to align Jetpack with your site data. If you still notice this error after running a full sync, please contact support for additional assistance.', 'jetpack' ),
            'long_description'  => $description,
          )
        );

      } else {
        // Get the Sync Queue.
        $sender     = Sync_Sender::get_instance();
        $sync_queue = $sender->get_sync_queue();

        // lag exceeds 5 minutes.
        if ( $sync_queue->lag() > 5 * MINUTE_IN_SECONDS ) {

          $description  = '<p>';
          $description .= esc_html__( 'The information synced by Jetpack ensures that Jetpack Search, Related Posts and other features are aligned with your site’s current content.', 'jetpack' );
          $description .= '</p>';
          $description .= '<p>';
          $description .= sprintf(
            '<span class="dashicons dashicons-clock" style="color: orange;"><span class="screen-reader-text">%1$s</span></span> ',
            /* translators: name, used to describe a clock icon. */
            esc_html__( 'Clock', 'jetpack' )
          );
          $description .= wp_kses(
            sprintf(
              /* translators: placeholder is a number of minutes. */
              _n(
                'Jetpack has identified a delay while syncing individual content updates. Certain features might be slower than usual, but this is only temporary while sync catches up with recent changes to your site. <strong>We’re seeing a current delay of %1$d minute.</strong>',
                'Jetpack has identified a delay while syncing individual content updates. Certain features might be slower than usual, but this is only temporary while sync catches up with recent changes to your site. <strong>We’re seeing a current delay of %1$d minutes.</strong>',
                (int) ( $sync_queue->lag() / MINUTE_IN_SECONDS ),
                'jetpack'
              ),
              number_format_i18n( $sync_queue->lag() / MINUTE_IN_SECONDS )
            ),
            array( 'strong' => array() )
          );
          $description .= '</p>';

          return self::informational_test(
            array(
              'name'              => $name,
              'label'             => __( 'Jetpack is experiencing a delay syncing your site.', 'jetpack' ),
              'severity'          => 'recommended',
              'action'            => null,
              'action_label'      => null,
              'short_description' => __( 'Jetpack is experiencing a delay syncing your site.', 'jetpack' ),
              'long_description'  => $description,
            )
          );

        } else {

          // Sync is Healthy.
          return self::passing_test( array( 'name' => $name ) );
[1] [2] Next »

 View on GitHub View on Trac

Share this:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Pinterest (Opens in new window)

Related

Published: 8 April 2020 | Last updated: 10 December 2020

Primary Sidebar

Information

Function name: Jetpack_Cxn_Tests::test__sync_health
Class ref: Jetpack_Cxn_Tests
Plugin ref: Jetpack
Version: 9.2
Sourcefile: _inc/lib/debugger/class-jetpack-cxn-tests.php
File ref: _inc/lib/debugger/class-jetpack-cxn-tests.php
Deprecated?: No
API Letters: C,J,T

Footer

Jetpack a2z
Jetpack a2z
Jetpack a2z
WordPress 5.6
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  jetpack.wp-a2z.org
© Copyright Jetpack a2z 2014-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites