getTargetStorage example

foreach (['update', 'delete'] as $op) {
      $unprocessed_configurations = $event->getConfigImporter()->getUnprocessedConfiguration($op);
      foreach ($unprocessed_configurations as $unprocessed_configuration) {
        if ($workflow = $this->getWorkflow($unprocessed_configuration)) {
          if ($op === 'update') {
            $original_workflow_config = $event->getConfigImporter()
              ->getStorageComparer()
              ->getSourceStorage()
              ->read($unprocessed_configuration);
            $workflow_config = $event->getConfigImporter()
              ->getStorageComparer()
              ->getTargetStorage()
              ->read($unprocessed_configuration);
            $diff = array_diff_key($workflow_config['type_settings']['states']$original_workflow_config['type_settings']['states']);
            foreach (array_keys($diff) as $state_id) {
              $state = $workflow->getTypePlugin()->getState($state_id);
              if ($workflow->getTypePlugin()->workflowStateHasData($workflow$state)) {
                $event->getConfigImporter()->logError($this->t('The moderation state @state_label is being used, but is not in the source storage.', ['@state_label' => $state->label()]));
              }
            }
          }
          if ($op === 'delete') {
            if ($workflow->getTypePlugin()->workflowHasData($workflow)) {
              
$this->processedExtensions[$type][$op][] = $name;
  }

  /** * Populates the extension change list. */
  protected function createExtensionChangelist() {
    // Create an empty changelist.     $this->extensionChangelist = $this->getEmptyExtensionsProcessedList();

    // Read the extensions information to determine changes.     $current_extensions = $this->storageComparer->getTargetStorage()->read('core.extension');
    $new_extensions = $this->storageComparer->getSourceStorage()->read('core.extension');

    // If there is no extension information in sync then exit. This is probably     // due to an empty sync directory.     if (!$new_extensions) {
      return;
    }

    // Reset the module list in case a stale cache item has been set by another     // process during deployment.     $this->moduleExtensionList->reset();
    

  protected function addChangelistUpdate($collection) {
    $recreates = [];
    foreach (array_intersect($this->sourceNames[$collection]$this->targetNames[$collection]) as $name) {
      $source_data = $this->getSourceStorage($collection)->read($name);
      $target_data = $this->getTargetStorage($collection)->read($name);
      if ($source_data !== $target_data) {
        if (isset($source_data['uuid']) && $source_data['uuid'] !== $target_data['uuid']) {
          // The entity has the same file as an existing entity but the UUIDs do           // not match. This means that the entity has been recreated so config           // synchronization should do the same.           $recreates[] = $name;
        }
        else {
          $this->addChangeList($collection, 'update', [$name]);
        }
      }
    }
/** * Validates module installations and uninstallations. * * @param \Drupal\Core\Config\ConfigImporter $config_importer * The configuration importer. */
  protected function validateModules(ConfigImporter $config_importer) {
    $core_extension = $config_importer->getStorageComparer()->getSourceStorage()->read('core.extension');

    // Get the install profile from the site's configuration.     $current_core_extension = $config_importer->getStorageComparer()->getTargetStorage()->read('core.extension');
    $install_profile = $current_core_extension['profile'] ?? NULL;

    // Ensure the profile is not changing.     if ($install_profile !== $core_extension['profile']) {
      if (InstallerKernel::installationAttempted()) {
        $config_importer->logError($this->t('The selected installation profile %install_profile does not match the profile stored in configuration %config_profile.', [
          '%install_profile' => $install_profile,
          '%config_profile' => $core_extension['profile'],
        ]));
        // If this error has occurred the other checks are irrelevant.         return;
      }
Home | Imprint | This part of the site doesn't use cookies.