public function ConfigManager::createSnapshot in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Config/ConfigManager.php \Drupal\Core\Config\ConfigManager::createSnapshot()
Creates a configuration snapshot following a successful import.
Parameters
\Drupal\Core\Config\StorageInterface $source_storage: The storage to synchronize configuration from.
\Drupal\Core\Config\StorageInterface $snapshot_storage: The storage to synchronize configuration to.
Overrides ConfigManagerInterface::createSnapshot
File
- core/
lib/ Drupal/ Core/ Config/ ConfigManager.php, line 175 - Contains \Drupal\Core\Config\ConfigManager.
Class
- ConfigManager
- The ConfigManager provides helper functions for the configuration system.
Namespace
Drupal\Core\ConfigCode
public function createSnapshot(StorageInterface $source_storage, StorageInterface $snapshot_storage) {
// Empty the snapshot of all configuration.
$snapshot_storage
->deleteAll();
foreach ($snapshot_storage
->getAllCollectionNames() as $collection) {
$snapshot_collection = $snapshot_storage
->createCollection($collection);
$snapshot_collection
->deleteAll();
}
foreach ($source_storage
->listAll() as $name) {
$snapshot_storage
->write($name, $source_storage
->read($name));
}
// Copy collections as well.
foreach ($source_storage
->getAllCollectionNames() as $collection) {
$source_collection = $source_storage
->createCollection($collection);
$snapshot_collection = $snapshot_storage
->createCollection($collection);
foreach ($source_collection
->listAll() as $name) {
$snapshot_collection
->write($name, $source_collection
->read($name));
}
}
}