function StorageComparer::validateSiteUuid

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Config/StorageComparer.php \Drupal\Core\Config\StorageComparer::validateSiteUuid()
  2. 10 core/lib/Drupal/Core/Config/StorageComparer.php \Drupal\Core\Config\StorageComparer::validateSiteUuid()
  3. 9 core/lib/Drupal/Core/Config/StorageComparer.php \Drupal\Core\Config\StorageComparer::validateSiteUuid()
  4. 8.9.x core/lib/Drupal/Core/Config/StorageComparer.php \Drupal\Core\Config\StorageComparer::validateSiteUuid()

Validates that the system.site::uuid in the source and target match.

Return value

bool TRUE if identical, FALSE if not.

Overrides StorageComparerInterface::validateSiteUuid

File

core/lib/Drupal/Core/Config/StorageComparer.php, line 433

Class

StorageComparer
Defines a config storage comparer.

Namespace

Drupal\Core\Config

Code

public function validateSiteUuid() {
  $target = $this->targetStorage
    ->read('system.site');
  // If there is no target configuration yet, then the entire site may be
  // getting reinstalled from config.
  if (!$target) {
    return TRUE;
  }
  $source = $this->sourceStorage
    ->read('system.site');
  // It is possible that the source storage does not contain system.site
  // configuration. In such cases the site UUID cannot be valid.
  return $source && $source['uuid'] === $target['uuid'];
}

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