function Tasks::runTasks

Same name in other branches
  1. 9 core/lib/Drupal/Core/Database/Install/Tasks.php \Drupal\Core\Database\Install\Tasks::runTasks()
  2. 8.9.x core/lib/Drupal/Core/Database/Install/Tasks.php \Drupal\Core\Database\Install\Tasks::runTasks()
  3. 11.x 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'];
}

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