8.3.x install.core.inc install_profile_modules(&$install_state)
8.0.x install.core.inc install_profile_modules(&$install_state)
8.1.x install.core.inc install_profile_modules(&$install_state)
8.2.x install.core.inc install_profile_modules(&$install_state)
8.4.x install.core.inc install_profile_modules(&$install_state)
7.x install.core.inc install_profile_modules(&$install_state)

Installs required modules via a batch process.


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

Return value

The batch definition.

2 string references to 'install_profile_modules'
install_system_module in includes/install.core.inc
Installation task; install the Drupal system module.
install_tasks in includes/install.core.inc
Returns a list of all tasks the installer currently knows about.


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


function install_profile_modules(&$install_state) {
  $modules = variable_get('install_profile_modules', array());
  $files = system_rebuild_module_data();

  // Always install required modules first. Respect the dependencies between
  // the modules.
  $required = array();
  $non_required = array();
  // Although the profile module is marked as required, it needs to go after
  // every dependency, including non-required ones. So clear its required
  // flag for now to allow it to install late.
  $files[$install_state['parameters']['profile']]->info['required'] = FALSE;
  // Add modules that other modules depend on.
  foreach ($modules as $module) {
    if ($files[$module]->requires) {
      $modules = array_merge($modules, array_keys($files[$module]->requires));
  $modules = array_unique($modules);
  foreach ($modules as $module) {
    if (!empty($files[$module]->info['required'])) {
      $required[$module] = $files[$module]->sort;
    else {
      $non_required[$module] = $files[$module]->sort;

  $operations = array();
  foreach ($required + $non_required as $module => $weight) {
    $operations[] = array('_install_module_batch', array($module, $files[$module]->info['name']));
  $batch = array(
    'operations' => $operations,
    'title' => st('Installing @drupal', array('@drupal' => drupal_install_profile_distribution_name())),
    'error_message' => st('The installation has encountered an error.'),
    'finished' => '_install_profile_modules_finished',
  return $batch;


aubjr_drupal’s picture

Is there a way to control the order that dependencies[] modules are installed during or before this step (in code, during site spinup)? When the dependencies stretch across multiple modules' your_module.info files, that are separately called as profile dependencies in /profiles/your_profile/your_profile.info?