public function DatabaseTasks::runTasks

7.x install.inc public DatabaseTasks::runTasks()

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

File

drupal-7.x/includes/install.inc, line 397
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 class="error">' . $result . '</p>';
    }
  }
  if (!empty($message)) {
    $message = '<p>In order for Drupal to work, and to continue with the installation process, you must resolve all issues reported below. For more help with configuring your database server, see the <a href="http://drupal.org/getting-started/install">installation handbook</a>. If you are unsure what any of this means you should probably contact your hosting provider.</p>' . $message;
    throw new DatabaseTaskException($message);
  }
}