Automattic\WooCommerce\Internal\ProductDownloads\ApprovedDirectories

Synchronize::run()publicWC 1.0

Runs the syncronization task.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

$Synchronize = new Synchronize();
$Synchronize->run();

Код Synchronize::run() WC 8.7.0

public function run() {
	$products = $this->get_next_set_of_downloadable_products();

	foreach ( $products as $product ) {
		$this->process_product( $product );
	}

	// Detect if we have reached the end of the task.
	if ( count( $products ) < self::SYNC_TASK_BATCH_SIZE ) {
		wc_get_logger()->log( 'info', __( 'Approved Download Directories sync: scan is complete!', 'woocommerce' ) );
		$this->stop();
	} else {
		wc_get_logger()->log(
			'info',
			sprintf(
			/* translators: %1$d is the current batch in the synchronization task, %2$d is the percent complete. */
				__( 'Approved Download Directories sync: completed batch %1$d (%2$d%% complete).', 'woocommerce' ),
				(int) get_option( self::SYNC_TASK_PAGE, 2 ) - 1,
				$this->get_progress()
			)
		);
		$this->queue->schedule_single( time() + 1, self::SYNC_TASK, array(), self::SYNC_TASK_GROUP );
	}
}