You are here

public function ConfigSyncSnapshotter::refreshSnapshot in Configuration Synchronizer 8

Takes a snapshot of configuration from modules and themes.

Only items not already in the snapshot storage are added.

Parameters

\Drupal\Core\Extension\Extension[] $extensions: Optional list of extensions for which to refresh the snapshot. If omitted, the entire snapshot will be refreshed.

Overrides ConfigSyncSnapshotterInterface::refreshSnapshot

File

src/ConfigSyncSnapshotter.php, line 77

Class

ConfigSyncSnapshotter
The ConfigSyncSnapshotter provides helper functions for taking snapshots of extension-provided configuration.

Namespace

Drupal\config_sync

Code

public function refreshSnapshot(array $extensions = []) {

  /* @var \Drupal\config_provider\InMemoryStorage $installable_config */
  $installable_config = $this->configCollector
    ->getInstallableConfig($extensions);

  // Set up a storage comparer.
  $storage_comparer = new StorageComparer($installable_config, $this->snapshotExtensionStorage, $this->configManager);
  $storage_comparer
    ->createChangelist();

  // Only add new items.
  $changelist = $storage_comparer
    ->getChangelist('create');
  foreach ($changelist as $item_name) {
    $this
      ->createItemSnapshot($installable_config, $item_name);
  }
}