public function DatabaseTasks::runTasks

7.x public DatabaseTasks::runTasks()

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


drupal-7.x/includes/, line 397
API functions for installing modules and themes.


Database installer structure.


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'])) {
      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="">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);