Action_Scheduler\WP_CLI\Action

Cancel_Command::cancel_all()protectedWC 1.0

Cancel all actions.

Method of the class: Cancel_Command{}

No Hooks.

Return

null. Nothing (null).

Usage

// protected - for code of main (parent) or child class
$result = $this->cancel_all( $hook, $callback_args, $group );
$hook(string) (required)
The hook that the job will trigger.
$callback_args(array) (required)
Args that would have been passed to the job.
$group(string) (required)
The group the job is assigned to.

Cancel_Command::cancel_all() code WC 9.8.1

protected function cancel_all( $hook, $callback_args, $group ) {
	if ( empty( $hook ) && empty( $group ) ) {
		\WP_CLI::error( __( 'Please specify hook and/or group of actions to cancel.', 'woocommerce' ) );
	}

	try {
		$result = as_unschedule_all_actions( $hook, $callback_args, $group );
	} catch ( \Exception $e ) {
		$this->print_error( $e, $multiple );
	}

	/**
	 * Because as_unschedule_all_actions() does not provide a result,
	 * neither confirm or deny actions cancelled.
	 */
	\WP_CLI::success( __( 'Request to cancel scheduled actions completed.', 'woocommerce' ) );
}