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.

Метод класса: BatchProcessingController{}

Хуков нет.

Возвращает

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

Использование

$BatchProcessingController = new BatchProcessingController();
$BatchProcessingController->remove_processor( $processor_class_name ): bool;
$processor_class_name(строка) (обязательный)
Fully qualified class name of the processor.

Код BatchProcessingController::remove_processor() WC 9.4.2

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 ) );
		$this->clear_processor_state( $processor_class_name );
	}

	return true;
}