WC_Helper_Updater::get_update_check_payload
The products to ask WooCommerce.com about, with the file ID and installed version of each.
Covers every subscription plus every installed plugin and theme carrying a Woo header, whether or not it has a subscription. Every caller has to send the same payload: the server decides the autoupdate flag from the installed version, and the response is cached under a hash of the payload.
Метод класса: WC_Helper_Updater{}
Хуков нет.
Возвращает
array. Payload keyed by product ID.
Использование
$result = WC_Helper_Updater::get_update_check_payload(): array;
Список изменений
| С версии 11.2.0 | Введена. |
Код WC_Helper_Updater::get_update_check_payload() WC Helper Updater::get update check payload WC 11.3.0
private static function get_update_check_payload(): array {
$payload = array();
foreach ( WC_Helper::get_subscriptions() as $subscription ) {
$product_id = (int) $subscription['product_id'];
$payload[ $product_id ] = array(
'product_id' => $product_id,
'file_id' => '',
'version' => '',
);
}
$installed = array_merge( WC_Helper::get_local_woo_plugins(), WC_Helper::get_local_woo_themes() );
foreach ( $installed as $data ) {
if ( ! isset( $payload[ $data['_product_id'] ] ) ) {
$payload[ $data['_product_id'] ] = array(
'product_id' => $data['_product_id'],
);
}
$payload[ $data['_product_id'] ]['file_id'] = $data['_file_id'];
$payload[ $data['_product_id'] ]['version'] = (string) ( $data['Version'] ?? '' );
}
return $payload;
}