Automattic\WooCommerce\Internal\ProductDownloads\ApprovedDirectories

Synchronize::init_feature()publicWC 1.0

Initializes the Approved Download Directories feature, typically following an update or during initial installation.

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

Хуков нет.

Возвращает

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

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

$Synchronize = new Synchronize();
$Synchronize->init_feature( $synchronize, $enable_feature );
$synchronize(true|false)
Synchronize with existing product downloads. Not needed in a fresh installation.
По умолчанию: true
$enable_feature(true|false)
Enable (default) or disable the feature.
По умолчанию: true

Код Synchronize::init_feature() WC 9.3.3

public function init_feature( bool $synchronize = true, bool $enable_feature = true ) {
	try {
		$this->add_default_directories();

		if ( $synchronize ) {
			$this->start();
		}
	} catch ( Exception $e ) {
		wc_get_logger()->log( 'warning', __( 'It was not possible to synchronize download directories following the most recent update.', 'woocommerce' ) );
	}

	$this->register->set_mode(
		$enable_feature ? Register::MODE_ENABLED : Register::MODE_DISABLED
	);
}