function MultisiteValidator::isMultisite

Detects if the current site is part of a multisite.

Return value

bool TRUE if the current site is part of a multisite, otherwise FALSE.

1 call to MultisiteValidator::isMultisite()
MultisiteValidator::validate in core/modules/package_manager/src/Validator/MultisiteValidator.php
Validates that the current site is not part of a multisite.

File

core/modules/package_manager/src/Validator/MultisiteValidator.php, line 45

Class

MultisiteValidator
Checks that the current site is not part of a multisite.

Namespace

Drupal\package_manager\Validator

Code

private function isMultisite() : bool {
  $web_root = $this->pathLocator
    ->getWebRoot();
  if ($web_root) {
    $web_root .= '/';
  }
  $sites_php_path = $this->pathLocator
    ->getProjectRoot() . '/' . $web_root . 'sites/sites.php';
  if (!file_exists($sites_php_path)) {
    return FALSE;
  }
  // @see \Drupal\Core\DrupalKernel::findSitePath()
  $sites = [];
  include $sites_php_path;
  // @see example.sites.php
  return count(array_unique($sites)) > 1;
}

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