You are here

public function ConfigurationExportManager::searchComplementaryConfigurations in Configuration Management 7.3

1 call to ConfigurationExportManager::searchComplementaryConfigurations()
ConfigurationExportManager::export in src/Helpers/ConfigurationExportManager.php
Export the configuration of the site into the filesystem.

File

src/Helpers/ConfigurationExportManager.php, line 91
ConfigurationExportManager.php handles the export of configurations.

Class

ConfigurationExportManager

Namespace

Configuration\Helpers

Code

public function searchComplementaryConfigurations() {
  $already_proccessed = array();
  $not_procesed_yet = $this->configurations_to_export
    ->keys();
  while (!empty($not_procesed_yet)) {
    $identifier = array_pop($not_procesed_yet);
    if (empty($already_proccessed[$identifier])) {

      // Load the current configuration
      $handler = $this->configuration_manager
        ->getHandlerFromIdentifier($identifier);
      $configuration = $handler
        ->loadFromDatabase($identifier);

      // Check if there are some alter proccess to apply to the recently
      // loaded configuration.
      $this
        ->alterConfiguration($configuration);

      // Search for available parts already defined for this configuration.
      $parts = $this->configuration_manager
        ->getReferences($identifier);
      $configuration
        ->setParts($parts);

      // Remove the current configuration from the list of pending for
      // proccess parts.
      $this->configuration_manager
        ->clearReferences($identifier);

      // Add the loaded configuration to the cache.
      $this->configuration_manager
        ->cache()
        ->set($configuration);
      $already_proccessed[$identifier] = TRUE;

      // Add its dependencies to the list of not proccesed
      foreach ($configuration
        ->getDependencies() as $dependency) {
        if (empty($already_proccessed[$dependency])) {
          $not_procesed_yet[] = $dependency;
        }
      }

      // Add its parts to the list of not proccesed
      foreach ($configuration
        ->getParts() as $part) {
        if (empty($already_proccessed[$part])) {
          $not_procesed_yet[] = $part;
        }
      }
    }
  }

  // Complete dependency map.
  $this->configuration_manager
    ->applyPendingOperations();
}