You are here

private function Updater::createActiveStage in Automatic Updates 8.2

Initializes an active update and returns its ID.

Parameters

string[] $package_versions: The versions of the packages to stage, keyed by package name.

Return value

string The active update ID.

1 call to Updater::createActiveStage()
Updater::begin in src/Updater.php
Begins the update.

File

src/Updater.php, line 242

Class

Updater
Defines a service to perform updates.

Namespace

Drupal\automatic_updates

Code

private function createActiveStage(array $package_versions) : string {
  $requirements = [];
  foreach ($package_versions as $package_name => $version) {
    $requirements[] = "{$package_name}:{$version}";
  }
  $value = static::STATE_KEY . microtime();
  $this->state
    ->set(static::STATE_KEY, [
    'id' => $value,
    'package_versions' => $requirements,
  ]);
  return $value;
}