WC_Helper_Updater::transient_update_plugins( object $transient )
Runs in a cron thread, or in a visitor thread if triggered by _maybe_update_plugins(), or in an auto-update thread.
Description Description
Parameters Parameters
- $transient
-
(Required) The update_plugins transient object.
Return Return
(object) The same or a modified version of the transient.
Source Source
File: includes/admin/helper/class-wc-helper-updater.php
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'],
);
// 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 ( 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 ] );
}
}
return $transient;
}