Automattic\WooCommerce\Internal\Logging
RemoteLogger::should_current_version_be_logged
Check if the current WooCommerce version is the latest.
Method of the class: RemoteLogger{}
No Hooks.
Returns
true|false.
Usage
// private - for code of main (parent) class only $result = $this->should_current_version_be_logged();
RemoteLogger::should_current_version_be_logged() RemoteLogger::should current version be logged code WC 10.6.2
private function should_current_version_be_logged() {
$new_version = SafeGlobalFunctionProxy::get_site_transient( self::WC_NEW_VERSION_TRANSIENT ) ?? '';
if ( false === $new_version ) {
$new_version = $this->fetch_new_woocommerce_version();
// Cache the new version for a week since we want to keep logging in with the same version for a while even if the new version is available.
SafeGlobalFunctionProxy::set_site_transient( self::WC_NEW_VERSION_TRANSIENT, $new_version, WEEK_IN_SECONDS );
}
if ( ! is_string( $new_version ) || '' === $new_version ) {
// If the new version is not available, we consider the current version to be the latest.
return true;
}
// If the current version is the latest, we don't want to log errors.
return version_compare( $this->get_wc_version(), $new_version, '>=' );
}