function install_verify_database_ready

Same name in other branches
  1. 9 core/includes/install.core.inc \install_verify_database_ready()
  2. 8.9.x core/includes/install.core.inc \install_verify_database_ready()
  3. 10 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 1181

Code

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

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