You are here

public function SystemConfigSubscriber::onConfigImporterValidateSiteUUID in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/system/src/SystemConfigSubscriber.php \Drupal\system\SystemConfigSubscriber::onConfigImporterValidateSiteUUID()

Checks that the configuration synchronization is valid.

This event listener checks that the system.site:uuid's in the source and target match.

Parameters

\Drupal\Core\Config\ConfigImporterEvent $event: The config import event.

File

core/modules/system/src/SystemConfigSubscriber.php, line 74

Class

SystemConfigSubscriber
System Config subscriber.

Namespace

Drupal\system

Code

public function onConfigImporterValidateSiteUUID(ConfigImporterEvent $event) {
  if (!$event
    ->getConfigImporter()
    ->getStorageComparer()
    ->getSourceStorage()
    ->exists('system.site')) {
    $event
      ->getConfigImporter()
      ->logError($this
      ->t('This import does not contain system.site configuration, so has been rejected.'));
  }
  if (!$event
    ->getConfigImporter()
    ->getStorageComparer()
    ->validateSiteUuid()) {
    $event
      ->getConfigImporter()
      ->logError($this
      ->t('Site UUID in source storage does not match the target storage.'));
  }
}