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{}

No Hooks.

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.6.1

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'        => $data['package'],
			'upgrade_notice' => $data['upgrade_notice'],
		);

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

		// We don't want to deliver a valid upgrade package when their subscription has expired.
		// To avoid the generic "no_package" error that empty strings give, we will store an
		// indication of expiration for the `upgrader_pre_download` filter to error on.
		if ( ! self::_has_active_subscription( $plugin['_product_id'] ) ) {
			$item['package'] = 'woocommerce-com-expired-' . $plugin['_product_id'];
		}

		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;
}