class UpdateProcessor implements UpdateProcessorInterface (View source)

Process project update information.

Properties

protected Config $updateSettings

The update settings.

protected UpdateFetcherInterface $updateFetcher

The UpdateFetcher service.

protected QueueInterface $fetchQueue

The update fetch queue.

protected KeyValueStoreExpirableInterface $tempStore

Update key/value store.

protected KeyValueStoreInterface $fetchTaskStore

Update Fetch Task Store.

protected KeyValueStoreExpirableInterface $availableReleasesTempStore

Update available releases store.

protected array $failed

Array of release history URLs that we have failed to fetch.

protected StateInterface $stateStore

The state service.

protected PrivateKey $privateKey

The private key.

Methods

__construct(ConfigFactoryInterface $config_factory, QueueFactory $queue_factory, UpdateFetcherInterface $update_fetcher, StateInterface $state_store, PrivateKey $private_key, KeyValueFactoryInterface $key_value_factory, KeyValueExpirableFactoryInterface $key_value_expirable_factory)

Constructs an UpdateProcessor.

createFetchTask(array $project)

Adds a task to the queue for fetching release history data for a project.

fetchData()

Attempts to drain the queue of tasks for release history data to fetch.

bool
processFetchTask(array $project)

Processes a task to fetch available update data for a single project.

array
parseXml(string $raw_xml)

Parses the XML of the Drupal release history info files.

int
numberOfQueueItems()

Retrieves the number of items in the update fetch queue.

bool|object
claimQueueItem()

Claims an item in the update fetch queue for processing.

deleteQueueItem(object $item)

Deletes a finished item from the update fetch queue.

Details

__construct(ConfigFactoryInterface $config_factory, QueueFactory $queue_factory, UpdateFetcherInterface $update_fetcher, StateInterface $state_store, PrivateKey $private_key, KeyValueFactoryInterface $key_value_factory, KeyValueExpirableFactoryInterface $key_value_expirable_factory)

Constructs an UpdateProcessor.

Parameters

ConfigFactoryInterface $config_factory

The config factory.

QueueFactory $queue_factory

The queue factory

UpdateFetcherInterface $update_fetcher

The update fetcher service

StateInterface $state_store

The state service.

PrivateKey $private_key

The private key factory service.

KeyValueFactoryInterface $key_value_factory

The key/value factory.

KeyValueExpirableFactoryInterface $key_value_expirable_factory

The expirable key/value factory.

createFetchTask(array $project)

Adds a task to the queue for fetching release history data for a project.

We only create a new fetch task if there's no task already in the queue for this particular project (based on 'update_fetch_task' key-value collection).

Parameters

array $project

Associative array of information about a project as created by \Drupal\update\UpdateManager::getProjects(), including keys such as 'name' (short name), and the 'info' array with data from a .info.yml file for the project.

fetchData()

Attempts to drain the queue of tasks for release history data to fetch.

bool processFetchTask(array $project)

Processes a task to fetch available update data for a single project.

Once the release history XML data is downloaded, it is parsed and saved in an entry just for that project.

Parameters

array $project

Associative array of information about the project to fetch data for.

Return Value

bool

TRUE if we fetched parsable XML, otherwise FALSE.

protected array parseXml(string $raw_xml)

Parses the XML of the Drupal release history info files.

Parameters

string $raw_xml

A raw XML string of available release data for a given project.

Return Value

array

Array of parsed data about releases for a given project, or NULL if there was an error parsing the string.

int numberOfQueueItems()

Retrieves the number of items in the update fetch queue.

Return Value

int

An integer estimate of the number of items in the queue.

bool|object claimQueueItem()

Claims an item in the update fetch queue for processing.

Return Value

bool|object

On success we return an item object. If the queue is unable to claim an item it returns false.

deleteQueueItem(object $item)

Deletes a finished item from the update fetch queue.

Parameters

object $item

The item returned by \Drupal\Core\Queue\QueueInterface::claimItem().