You are here

function install_verify_database_ready in Drupal 8

Same name and namespace in other branches
  1. 9 core/includes/install.core.inc \install_verify_database_ready()

Verify that the database is ready (no existing Drupal installation).

Throws

\Drupal\Core\Installer\Exception\AlreadyInstalledException Thrown when the database already has a table that would be created by installing the System module.

1 call to install_verify_database_ready()
install_begin_request in core/includes/install.core.inc
Begins an installation request, modifying the installation state as needed.

File

core/includes/install.core.inc, line 1172
API functions for installing Drupal.

Code

function install_verify_database_ready() {
  $system_schema = system_schema();
  end($system_schema);
  $table = key($system_schema);
  $existing_install = FALSE;
  if ($database = Database::getConnectionInfo()) {
    try {
      $existing_install = Database::getConnection()
        ->schema()
        ->tableExists($table);
    } catch (\Exception $e) {
    }
  }
  if ($existing_install) {
    throw new AlreadyInstalledException(\Drupal::service('string_translation'));
  }
}