Automattic\WooCommerce\Internal
DownloadPermissionsAdjuster::maybe_schedule_adjust_download_permissions() public WC 1.0
Schedule a download permissions adjustment for a product if necessary. This should be executed whenever a product is saved.
{} Это метод класса: DownloadPermissionsAdjuster{}
Хуков нет.
Возвращает
Null. Ничего.
Использование
$DownloadPermissionsAdjuster = new DownloadPermissionsAdjuster(); $DownloadPermissionsAdjuster->maybe_schedule_adjust_download_permissions( \WC_Product $product );
- \WC_Product $product (обязательный)
- -
Код DownloadPermissionsAdjuster::maybe_schedule_adjust_download_permissions() DownloadPermissionsAdjuster::maybe schedule adjust download permissions WC 5.0.0
public function maybe_schedule_adjust_download_permissions( \WC_Product $product ) {
$children_ids = $product->get_children();
if ( ! $children_ids ) {
return;
}
$scheduled_action_args = array( $product->get_id() );
$already_scheduled_actions =
WC()->call_function(
'as_get_scheduled_actions',
array(
'hook' => 'adjust_download_permissions',
'args' => $scheduled_action_args,
'status' => \ActionScheduler_Store::STATUS_PENDING,
),
'ids'
);
if ( empty( $already_scheduled_actions ) ) {
WC()->call_function(
'as_schedule_single_action',
WC()->call_function( 'time' ) + 1,
'adjust_download_permissions',
$scheduled_action_args
);
}
}