ActionScheduler_wpPostStore::release_claim()publicWC 1.0

Release claim.

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

Хуков нет.

Возвращает

null. Ничего.

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

$ActionScheduler_wpPostStore = new ActionScheduler_wpPostStore();
$ActionScheduler_wpPostStore->release_claim( $claim );
$claim(ActionScheduler_ActionClaim) (обязательный)
Claim object to release.

Код ActionScheduler_wpPostStore::release_claim() WC 6.9.4

public function release_claim( ActionScheduler_ActionClaim $claim ) {
	$action_ids = $this->find_actions_by_claim_id( $claim->get_id() );
	if ( empty( $action_ids ) ) {
		return; // nothing to do.
	}
	$action_id_string = implode( ',', array_map( 'intval', $action_ids ) );
	/**
	 * Global wpdb object.
	 *
	 * @var wpdb $wpdb
	 */
	global $wpdb;

	// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
	$result = $wpdb->query(
		$wpdb->prepare(
			"UPDATE {$wpdb->posts} SET post_password = '' WHERE ID IN ($action_id_string) AND post_password = %s", //phpcs:ignore
			array(
				$claim->get_id(),
			)
		)
	);
	if ( false === $result ) {
		/* translators: %s: claim ID */
		throw new RuntimeException( sprintf( __( 'Unable to unlock claim %s. Database error.', 'woocommerce' ), $claim->get_id() ) );
	}
}