Automattic\WooCommerce\Admin

DataSourcePoller::read_specs_from_data_sources()publicWC 1.0

Reads the data sources for specs and persists those specs.

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

Хуки из метода

Возвращает

true|false. Whether any specs were read.

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

$DataSourcePoller = new DataSourcePoller();
$DataSourcePoller->read_specs_from_data_sources();

Код DataSourcePoller::read_specs_from_data_sources() WC 7.3.0

public function read_specs_from_data_sources() {
	$specs        = array();
	$data_sources = apply_filters( self::FILTER_NAME, $this->data_sources, $this->id );

	// Note that this merges the specs from the data sources based on the
	// id - last one wins.
	foreach ( $data_sources as $url ) {
		$specs_from_data_source = self::read_data_source( $url );
		$this->merge_specs( $specs_from_data_source, $specs, $url );
	}

	$specs_group            = get_transient( $this->args['transient_name'] ) ?? array();
	$locale                 = get_user_locale();
	$specs_group[ $locale ] = $specs;
	// Persist the specs as a transient.
	set_transient(
		$this->args['transient_name'],
		$specs_group,
		$this->args['transient_expiry']
	);
	return count( $specs ) !== 0;
}