WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Получай пассивный доход от сайта с помощью браузерных PUSH уведомлений
функция не описана

ActionScheduler_wpPostStore::claim_actions() protected WC 1.0

{} Это метод класса: ActionScheduler_wpPostStore{}

Хуков нет.

Возвращает

Число. The number of actions that were claimed

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->claim_actions( $claim_id, $limit, $before_date, $hooks, $group );
$claim_id(строка) (обязательный)
-
$limit(число) (обязательный)
-
$before_date(DateTime)
Should use UTC timezone.
$hooks(массив)
Claim only actions with a hook or hooks.
$group(строка)
Claim only actions in the given group.

Код ActionScheduler_wpPostStore::claim_actions() WC 5.2.2

<?php
protected function claim_actions( $claim_id, $limit, DateTime $before_date = null, $hooks = array(), $group = '' ) {
	// Set up initial variables.
	$date      = null === $before_date ? as_get_datetime_object() : clone $before_date;
	$limit_ids = ! empty( $group );
	$ids       = $limit_ids ? $this->get_actions_by_group( $group, $limit, $date ) : array();

	// If limiting by IDs and no posts found, then return early since we have nothing to update.
	if ( $limit_ids && 0 === count( $ids ) ) {
		return 0;
	}

	/** @var wpdb $wpdb */
	global $wpdb;

	/*
	 * Build up custom query to update the affected posts. Parameters are built as a separate array
	 * to make it easier to identify where they are in the query.
	 *
	 * We can't use $wpdb->update() here because of the "ID IN ..." clause.
	 */
	$update = "UPDATE {$wpdb->posts} SET post_password = %s, post_modified_gmt = %s, post_modified = %s";
	$params = array(
		$claim_id,
		current_time( 'mysql', true ),
		current_time( 'mysql' ),
	);

	// Build initial WHERE clause.
	$where    = "WHERE post_type = %s AND post_status = %s AND post_password = ''";
	$params[] = self::POST_TYPE;
	$params[] = ActionScheduler_Store::STATUS_PENDING;

	if ( ! empty( $hooks ) ) {
		$placeholders = array_fill( 0, count( $hooks ), '%s' );
		$where       .= ' AND post_title IN (' . join( ', ', $placeholders ) . ')';
		$params       = array_merge( $params, array_values( $hooks ) );
	}

	/*
	 * Add the IDs to the WHERE clause. IDs not escaped because they came directly from a prior DB query.
	 *
	 * If we're not limiting by IDs, then include the post_date_gmt clause.
	 */
	if ( $limit_ids ) {
		$where .= ' AND ID IN (' . join( ',', $ids ) . ')';
	} else {
		$where .= ' AND post_date_gmt <= %s';
		$params[] = $date->format( 'Y-m-d H:i:s' );
	}

	// Add the ORDER BY clause and,ms limit.
	$order    = 'ORDER BY menu_order ASC, post_date_gmt ASC, ID ASC LIMIT %d';
	$params[] = $limit;

	// Run the query and gather results.
	$rows_affected = $wpdb->query( $wpdb->prepare( "{$update} {$where} {$order}", $params ) );
	if ( $rows_affected === false ) {
		throw new RuntimeException( __( 'Unable to claim actions. Database error.', 'woocommerce' ) );
	}

	return (int) $rows_affected;
}