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.

Method of the class: Synchronize{}

No Hooks.

Return

null. Nothing (null).

Usage

$Synchronize = new Synchronize();
$Synchronize->init_feature( $synchronize, $enable_feature );
$synchronize(true|false)
Synchronize with existing product downloads. Not needed in a fresh installation.
Default: true
$enable_feature(true|false)
Enable (default) or disable the feature.
Default: true

Synchronize::init_feature() code WC 8.7.0

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
	);
}