Automattic\WooCommerce\Internal\Logging
RemoteLogger::fetch_new_woocommerce_version
Fetch the new version of WooCommerce from the WordPress API.
Метод класса: RemoteLogger{}
Хуков нет.
Возвращает
Строку|null. New version if an update is available, null otherwise.
Использование
// private - только в коде основоного (родительского) класса $result = $this->fetch_new_woocommerce_version();
Код RemoteLogger::fetch_new_woocommerce_version() RemoteLogger::fetch new woocommerce version WC 10.5.0
private function fetch_new_woocommerce_version() {
$plugin_updates = SafeGlobalFunctionProxy::get_plugin_updates();
// Check if WooCommerce plugin update information is available.
if ( ! is_array( $plugin_updates ) || ! isset( $plugin_updates[ WC_PLUGIN_BASENAME ] ) ) {
return null;
}
$wc_plugin_update = $plugin_updates[ WC_PLUGIN_BASENAME ];
// Ensure the update object exists and has the required information.
if ( ! $wc_plugin_update || ! isset( $wc_plugin_update->update->new_version ) ) {
return null;
}
$new_version = $wc_plugin_update->update->new_version;
return is_string( $new_version ) ? $new_version : null;
}