You are here

protected function InstallCommand::isDrupalInstalled in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Command/InstallCommand.php \Drupal\Core\Command\InstallCommand::isDrupalInstalled()
  2. 10 core/lib/Drupal/Core/Command/InstallCommand.php \Drupal\Core\Command\InstallCommand::isDrupalInstalled()

Returns whether there is already an existing Drupal installation.

Return value

bool

1 call to InstallCommand::isDrupalInstalled()
InstallCommand::execute in core/lib/Drupal/Core/Command/InstallCommand.php

File

core/lib/Drupal/Core/Command/InstallCommand.php, line 97

Class

InstallCommand
Installs a Drupal site for local testing/development.

Namespace

Drupal\Core\Command

Code

protected function isDrupalInstalled() {
  try {
    $kernel = new DrupalKernel('prod', $this->classLoader, FALSE);
    $kernel::bootEnvironment();
    $kernel
      ->setSitePath($this
      ->getSitePath());
    Settings::initialize($kernel
      ->getAppRoot(), $kernel
      ->getSitePath(), $this->classLoader);
    $kernel
      ->boot();
  } catch (ConnectionNotDefinedException $e) {
    return FALSE;
  }
  return !empty(Database::getConnectionInfo());
}