You are here

class TakeoverConfig_Storage in MongoDB 8

Copies config storage.

Hierarchy

Expanded class hierarchy of TakeoverConfig_Storage

File

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

Namespace

Drupal\takeover
View source
class TakeoverConfig_Storage {

  /**
   * {@inheritdoc}
   */
  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));
      }
    }
  }

}

Members