Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
WC_Helper_Updater::_update_check( array $payload )
Run an update check API call.
Description Description
The call is cached based on the payload (product ids, file ids). If the payload changes, the cache is going to miss.
Parameters Parameters
- $payload
-
(Required) Information about the plugin to update.
Return Return
(array) Update data for each requested product.
Source Source
File: includes/admin/helper/class-wc-helper-updater.php
private static function _update_check( $payload ) { ksort( $payload ); $hash = md5( wp_json_encode( $payload ) ); $cache_key = '_woocommerce_helper_updates'; $data = get_transient( $cache_key ); if ( false !== $data ) { if ( hash_equals( $hash, $data['hash'] ) ) { return $data['products']; } } $data = array( 'hash' => $hash, 'updated' => time(), 'products' => array(), 'errors' => array(), ); $request = WC_Helper_API::post( 'update-check', array( 'body' => wp_json_encode( array( 'products' => $payload ) ), 'authenticated' => true, ) ); if ( wp_remote_retrieve_response_code( $request ) !== 200 ) { $data['errors'][] = 'http-error'; } else { $data['products'] = json_decode( wp_remote_retrieve_body( $request ), true ); } set_transient( $cache_key, $data, 12 * HOUR_IN_SECONDS ); return $data['products']; }