function SystemConfigSubscriber::onConfigImporterValidateSiteUUID

Same name and namespace in other branches
  1. 9 core/modules/system/src/SystemConfigSubscriber.php \Drupal\system\SystemConfigSubscriber::onConfigImporterValidateSiteUUID()
  2. 8.9.x core/modules/system/src/SystemConfigSubscriber.php \Drupal\system\SystemConfigSubscriber::onConfigImporterValidateSiteUUID()
  3. 10 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 75

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.'));
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.