Automattic\WooCommerce\Internal\ProductDownloads\ApprovedDirectories

Synchronize::has_scheduled_task │ private │ WC 1.0

Indicates whether a synchronization task is pending or running.

Method of the class: Synchronize{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->has_scheduled_task(): bool;

Synchronize::has_scheduled_task() code WC 11.2.1

private function has_scheduled_task(): bool {
	foreach ( array( ActionScheduler_Store::STATUS_PENDING, ActionScheduler_Store::STATUS_RUNNING ) as $status ) {
		$scheduled_tasks = $this->queue->search(
			array(
				'hook'     => self::SYNC_TASK,
				'status'   => $status,
				'per_page' => 1,
			),
			'ids'
		);

		if ( ! empty( $scheduled_tasks ) ) {
			return true;
		}
	}

	return false;
}