ActionScheduler_DBStore::mark_complete
Mark an action as complete.
Method of the class: ActionScheduler_DBStore{}
Hooks from the method
Returns
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() ActionScheduler DBStore::mark complete code WC 10.8.1
public function mark_complete( $action_id ) {
/**
* Global.
*
* @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 ) ) {
/* translators: %s is the action ID */
throw new \InvalidArgumentException( sprintf( __( 'Unidentified action %s: we were unable to mark this action as having completed. It may may have been deleted by another process.', 'woocommerce' ), $action_id ) );
}
/**
* 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 );
}