1 install.inc public DatabaseTasks::runTasks()

Run database tasks and tests to see if Backdrop can run on the database.

File

core/includes/install.inc, line 402
API functions for installing modules and themes.

Class

DatabaseTasks
Database installer structure.

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(array($this, $task['function']), $task['arguments'])) {
          break;
        }
      }
      else {
        throw new DatabaseTaskException(st("Failed to run all tasks against the database server. The task %task wasn't found.", array('%task' => $task['function'])));
      }
    }
  }
  // Check for failed results and compile message.
  $message = '';
  foreach ($this->results as $result => $success) {
    if (!$success) {
      $message .= '<p>' . $result . '</p>';
    }
  }
  if (!empty($message)) {
    $message .= '<p>For more help with configuring your database server, see the <a href="https://backdropcms.org/installation">Installation Instructions</a> page.</p>';
    throw new DatabaseTaskException($message);
  }
}