ActionScheduler_DBStore::mark_complete()publicWC 1.0

Mark an action as complete.

Method of the class: ActionScheduler_DBStore{}

Hooks from the method

Return

null. Nothing (null).

Usage

$ActionScheduler_DBStore = new ActionScheduler_DBStore();
$ActionScheduler_DBStore->mark_complete( $action_id );
$action_id(int) (required)
Action ID.

ActionScheduler_DBStore::mark_complete() code WC 8.7.0

public function mark_complete( $action_id ) {
	/** @var \wpdb $wpdb */
	global $wpdb;
	$updated = $wpdb->update(
		$wpdb->actionscheduler_actions,
		array(
			'status'             => self::STATUS_COMPLETE,
			'last_attempt_gmt'   => current_time( 'mysql', true ),
			'last_attempt_local' => current_time( 'mysql' ),
		),
		array( 'action_id' => $action_id ),
		array( '%s' ),
		array( '%d' )
	);
	if ( empty( $updated ) ) {
		throw new \InvalidArgumentException( sprintf( __( 'Unidentified action %s', 'woocommerce' ), $action_id ) ); //phpcs:ignore WordPress.WP.I18n.MissingTranslatorsComment
	}

	/**
	 * Fires after a scheduled action has been completed.
	 *
	 * @since 3.4.2
	 *
	 * @param int $action_id Action ID.
	 */
	do_action( 'action_scheduler_completed_action', $action_id );
}