ActionScheduler_DBStore::cancel_action
Cancel an action.
Method of the class: ActionScheduler_DBStore{}
Hooks from the method
Returns
null. Nothing (null).
Usage
$ActionScheduler_DBStore = new ActionScheduler_DBStore(); $ActionScheduler_DBStore->cancel_action( $action_id );
- $action_id(int) (required)
- Action ID.
ActionScheduler_DBStore::cancel_action() ActionScheduler DBStore::cancel action code WC 10.8.1
public function cancel_action( $action_id ) {
/**
* Global.
*
* @var \wpdb $wpdb
*/
global $wpdb;
$updated = $wpdb->update(
$wpdb->actionscheduler_actions,
array( 'status' => self::STATUS_CANCELED ),
array( 'action_id' => $action_id ),
array( '%s' ),
array( '%d' )
);
if ( false === $updated ) {
/* translators: %s: action ID */
throw new \InvalidArgumentException( sprintf( __( 'Unidentified action %s: we were unable to cancel this action. It may may have been deleted by another process.', 'woocommerce' ), $action_id ) );
}
do_action( 'action_scheduler_canceled_action', $action_id );
}