Automattic\WooCommerce\Internal\BatchProcessing

BatchProcessingController::remove_processor()publicWC 1.0

Dequeue and de-schedule a processor instance so that it won't be processed anymore.

Method of the class: BatchProcessingController{}

No Hooks.

Return

true|false. True if the processor has been dequeued, false if the processor wasn't enqueued (so nothing has been done).

Usage

$BatchProcessingController = new BatchProcessingController();
$BatchProcessingController->remove_processor( $processor_class_name ): bool;
$processor_class_name(string) (required)
Fully qualified class name of the processor.

BatchProcessingController::remove_processor() code WC 8.7.0

public function remove_processor( string $processor_class_name ): bool {
	$enqueued_processors = $this->get_enqueued_processors();
	if ( ! in_array( $processor_class_name, $enqueued_processors, true ) ) {
		return false;
	}

	$enqueued_processors = array_diff( $enqueued_processors, array( $processor_class_name ) );
	if ( empty( $enqueued_processors ) ) {
		$this->force_clear_all_processes();
	} else {
		update_option( self::ENQUEUED_PROCESSORS_OPTION_NAME, $enqueued_processors, false );
		as_unschedule_all_actions( self::PROCESS_SINGLE_BATCH_ACTION_NAME, array( $processor_class_name ) );
	}

	return true;
}