You are here

public function Tasks::runTasks in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Database/Install/Tasks.php \Drupal\Core\Database\Install\Tasks::runTasks()
  2. 9 core/lib/Drupal/Core/Database/Install/Tasks.php \Drupal\Core\Database\Install\Tasks::runTasks()

Runs database tasks and tests to see if Drupal can run on the database.

Return value

string[] A list of error messages.

File

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

Class

Tasks
Database installer structure.

Namespace

Drupal\Core\Database\Install

Code

public function runTasks() {

  // We need to establish a connection before we can run tests.
  if ($this
    ->connect()) {
    foreach ($this->tasks as $task) {
      if (!isset($task['function'])) {
        $task['function'] = 'runTestQuery';
      }
      if (method_exists($this, $task['function'])) {

        // Returning false is fatal. No other tasks can run.
        if (FALSE === call_user_func_array([
          $this,
          $task['function'],
        ], $task['arguments'])) {
          break;
        }
      }
      else {
        $this
          ->fail(t("Failed to run all tasks against the database server. The task %task wasn't found.", [
          '%task' => $task['function'],
        ]));
      }
    }
  }
  return $this->results['fail'];
}