function install_verify_database_ready

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

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'));
    }
}

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