function Tasks::runTestQuery

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Database/Install/Tasks.php \Drupal\Core\Database\Install\Tasks::runTestQuery()
  2. 8.9.x core/lib/Drupal/Core/Database/Install/Tasks.php \Drupal\Core\Database\Install\Tasks::runTestQuery()
  3. 11.x core/lib/Drupal/Core/Database/Install/Tasks.php \Drupal\Core\Database\Install\Tasks::runTestQuery()

Ensures the database can execute commands with the current user.

File

core/lib/Drupal/Core/Database/Install/Tasks.php, line 206

Class

Tasks
Database installer structure.

Namespace

Drupal\Core\Database\Install

Code

protected function runTestQuery($query, $pass, $fail, $fatal = FALSE) {
  try {
    Database::getConnection()->query($query);
    $this->pass(t($pass));
  } catch (\Exception $e) {
    $this->fail(t($fail, [
      '%query' => $query,
      '%error' => $e->getMessage(),
      '%name' => $this->name(),
    ]));
    return !$fatal;
  }
}

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