You are here

function install_verify_database_ready in Drupal 10

Same name and namespace in other branches
  1. 8 core/includes/install.core.inc \install_verify_database_ready()
  2. 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.
1 string reference to 'install_verify_database_ready'
install_tasks in core/includes/install.core.inc
Returns a list of all tasks the installer currently knows about.

File

core/includes/install.core.inc, line 1169
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::getConnectionInfo()) {
    try {
      $existing_install = Database::getConnection()
        ->schema()
        ->tableExists($table);
    } catch (\Exception $e) {
    }
  }
  if ($existing_install) {
    throw new AlreadyInstalledException(\Drupal::service('string_translation'));
  }
}