Automattic / woocommerce-services

WooCommerce Services is a feature plugin that integrates hosted services into WooCommerce (3.0+), and currently includes automated tax rates and the ability to purchase and print USPS shipping labels.
GNU General Public License v2.0
107 stars 20 forks source link

Jetpack PHP Notice jetpack_is_atomic_site #2713

Open bd-viget opened 8 months ago

bd-viget commented 8 months ago

I'm showing a frequent PHP Notice in my error logs:

NOTICE: PHP message: The jetpack_is_atomic_site function will be removed from the Jetpack plugin in version 10.9.

The source is coming from classes/class-wc-connect-jetpack.php Line 64:

public static function is_atomic_site() {
    if ( function_exists( 'jetpack_is_atomic_site' ) ) {
        return jetpack_is_atomic_site();
    }

    if ( function_exists( 'jetpack_is_automated_transfer_site' ) ) {
        return jetpack_is_automated_transfer_site();
    }

    return false;
}

This happens frequently, so I assume it's tied to the WP Heartbeat action.

bd-viget commented 6 months ago

My suggestion would be to swap the function_exists logic to move jetpack_is_atomic_site 2nd.

public static function is_atomic_site() {
    if ( function_exists( 'jetpack_is_automated_transfer_site' ) ) {
        return jetpack_is_automated_transfer_site();
    }

    if ( function_exists( 'jetpack_is_atomic_site' ) ) {
        return jetpack_is_atomic_site();
    }

    return false;
}

And maybe even deprecate WC_Connect_Jetpack::is_atomic_site() and create WC_Connect_Jetpack::is_automated_transfer_site()?