ActionScheduler_wpPostStore::mark_failure()publicWC 1.0

Mark failure on action.

Method of the class: ActionScheduler_wpPostStore{}

No Hooks.

Return

null. Nothing (null).

Usage

$ActionScheduler_wpPostStore = new ActionScheduler_wpPostStore();
$ActionScheduler_wpPostStore->mark_failure( $action_id );
$action_id(int) (required)
Action ID.

ActionScheduler_wpPostStore::mark_failure() code WC 8.7.0

public function mark_failure( $action_id ) {
	/**
	 * 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_status = %s WHERE ID = %d AND post_type = %s", self::STATUS_FAILED, $action_id, self::POST_TYPE )
	);
	if ( false === $result ) {
		/* translators: %s: action ID */
		throw new RuntimeException( sprintf( __( 'Unable to mark failure on action %s. Database error.', 'woocommerce' ), $action_id ) );
	}
}