You are here

public static function TakeoverConfig_Storage::takeover in MongoDB 8

File

takeover/src/TakeoverConfig_Storage.php, line 20
Contains \Drupal\takeover\TakeoverConfigStorageActive.

Class

TakeoverConfig_Storage
Copies config storage.

Namespace

Drupal\takeover

Code

public static function takeover(StorageInterface $source, StorageInterface $destination) {
  foreach ($source
    ->listAll() as $name) {
    $destination
      ->write($name, $source
      ->read($name));
  }
  foreach ($source
    ->getAllCollectionNames() as $collection_name) {
    $collection_destination = $destination
      ->createCollection($collection_name);
    $collection_source = $source
      ->createCollection($collection_name);
    foreach ($collection_source
      ->listAll() as $name) {
      $collection_destination
        ->write($name, $collection_source
        ->read($name));
    }
  }
}