Automattic\WooCommerce\Internal\PushNotifications\Services
DriverAvailabilityService::is_jetpack_sync_enabled
Determines whether Jetpack Sync is enabled. Treated as not enabled when the package isn't installed, or when the package throws.
The call reaches third-party package code, so it is guarded: an Error from an incompatible Jetpack would otherwise escape \Automattic\WooCommerce\Internal\RestApiControllerBase::run(), which catches Exception only, and turn an endpoint whose purpose is to stay reachable into a 500.
Method of the class: DriverAvailabilityService{}
No Hooks.
Returns
bool.
Usage
// protected - for code of main (parent) or child class $result = $this->is_jetpack_sync_enabled(): bool;
Changelog
| Since 11.2.0 | Introduced. |
DriverAvailabilityService::is_jetpack_sync_enabled() DriverAvailabilityService::is jetpack sync enabled code WC 11.3.0
protected function is_jetpack_sync_enabled(): bool {
$is_sync_enabled = array( self::JETPACK_SYNC_SETTINGS_CLASS, 'is_sync_enabled' );
if ( ! is_callable( $is_sync_enabled ) ) {
// class_exists() already passed, so the class is present but the method
// is not: an incompatible Jetpack Sync rather than a merchant choice.
// Recorded so this reports as undetermined rather than a definitive no.
$this->failed_checks[ self::CHECK_SYNC_ENABLED ] = true;
return false;
}
try {
return (bool) call_user_func( $is_sync_enabled );
} catch ( Throwable $e ) {
$this->failed_checks[ self::CHECK_SYNC_ENABLED ] = true;
$this->log_throwable( 'Error determining Jetpack Sync state for push notifications', $e );
return false;
}
}