You are here

function install_tasks_to_perform in Drupal 8

Same name and namespace in other branches
  1. 7 includes/install.core.inc \install_tasks_to_perform()
  2. 9 core/includes/install.core.inc \install_tasks_to_perform()
  3. 10 core/includes/install.core.inc \install_tasks_to_perform()

Returns a list of tasks to perform during the current installation request.

Note that the list of tasks can change based on the installation state as the page request evolves (for example, if an installation profile hasn't been selected yet, we don't yet know which profile tasks need to be run).

Parameters

$install_state: An array of information about the current installation state.

Return value

A list of tasks to be performed, with associated metadata.

2 calls to install_tasks_to_perform()
InstallCommand::install in core/lib/Drupal/Core/Command/InstallCommand.php
Installs Drupal with specified installation profile.
install_run_tasks in core/includes/install.core.inc
Runs all tasks for the current installation request.

File

core/includes/install.core.inc, line 712
API functions for installing Drupal.

Code

function install_tasks_to_perform($install_state) {

  // Start with a list of all currently available tasks.
  $tasks = install_tasks($install_state);
  foreach ($tasks as $name => $task) {

    // Remove any tasks that were already performed or that never should run.
    // Also, if we started this page request with an indication of the last
    // task that was completed, skip that task and all those that come before
    // it, unless they are marked as always needing to run.
    if ($task['run'] == INSTALL_TASK_SKIP || in_array($name, $install_state['tasks_performed']) || !empty($install_state['completed_task']) && empty($completed_task_found) && $task['run'] != INSTALL_TASK_RUN_IF_REACHED) {
      unset($tasks[$name]);
    }
    if (!empty($install_state['completed_task']) && $name == $install_state['completed_task']) {
      $completed_task_found = TRUE;
    }
  }
  return $tasks;
}