WC_Helper_Updater::transient_update_plugins()public staticWC 1.0

Runs in a cron thread, or in a visitor thread if triggered by _maybe_update_plugins(), or in an auto-update thread.

Method of the class: WC_Helper_Updater{}

Hooks from the method

Return

Object. The same or a modified version of the transient.

Usage

$result = WC_Helper_Updater::transient_update_plugins( $transient );
$transient(object) (required)
The update_plugins transient object.

WC_Helper_Updater::transient_update_plugins() code WC 8.9.0

public static function transient_update_plugins( $transient ) {
	$update_data = self::get_update_data();

	foreach ( WC_Helper::get_local_woo_plugins() as $plugin ) {
		if ( empty( $update_data[ $plugin['_product_id'] ] ) ) {
			continue;
		}

		$data     = $update_data[ $plugin['_product_id'] ];
		$filename = $plugin['_filename'];

		$item = array(
			'id'             => 'woocommerce-com-' . $plugin['_product_id'],
			'slug'           => 'woocommerce-com-' . $data['slug'],
			'plugin'         => $filename,
			'new_version'    => $data['version'],
			'url'            => $data['url'],
			'package'        => '',
			'upgrade_notice' => $data['upgrade_notice'],
		);

		/**
		 * Filters the Woo plugin data before saving it in transient used for updates.
		 *
		 * @since 8.7.0
		 *
		 * @param array $item Plugin item to modify.
		 * @param array $data Subscription data fetched from Helper API for the plugin.
		 * @param int   $product_id Woo product id assigned to the plugin.
		 */
		$item = apply_filters( 'update_woo_com_subscription_details', $item, $data, $plugin['_product_id'] );

		if ( isset( $data['requires_php'] ) ) {
			$item['requires_php'] = $data['requires_php'];
		}

		if ( $transient instanceof stdClass ) {
			if ( version_compare( $plugin['Version'], $data['version'], '<' ) ) {
				$transient->response[ $filename ] = (object) $item;
				unset( $transient->no_update[ $filename ] );
			} else {
				$transient->no_update[ $filename ] = (object) $item;
				unset( $transient->response[ $filename ] );
			}
		}
	}

	if ( $transient instanceof stdClass ) {
		$translations            = self::get_translations_update_data();
		$transient->translations = array_merge( isset( $transient->translations ) ? $transient->translations : array(), $translations );
	}

	return $transient;
}