You are here

function features_install_modules in Features 7

Same name and namespace in other branches
  1. 6 features.module \features_install_modules()
  2. 7.2 features.module \features_install_modules()

Enables and installs an array of modules, ignoring those already enabled & installed. Consider this a helper or extension to drupal_install_modules().

Parameters

$modules: An array of modules to install.

$reset: Clear the module info cache.

2 calls to features_install_modules()
dependencies_features_rebuild in includes/features.features.inc
Implements hook_features_rebuild(). Ensure that all of a feature's dependencies are enabled.
features_form_submit in ./features.admin.inc
Submit handler for the 'manage features' form

File

./features.module, line 551
Module file for the features module, which enables the capture and management of features in Drupal. A feature is a collection of Drupal entities which taken together statisfy a certain use-case.

Code

function features_install_modules($modules) {
  module_load_include('inc', 'features', 'features.export');
  $files = system_rebuild_module_data();

  // Build maximal list of dependencies.
  $install = array();
  foreach ($modules as $name) {

    // Parse the dependency string into the module name and version information.
    $parsed_name = drupal_parse_dependency($name);
    $name = $parsed_name['name'];
    if ($file = $files[$name]) {
      $install[] = $name;
      if (!empty($file->info['dependencies'])) {
        $install = array_merge($install, _features_export_maximize_dependencies($file->info['dependencies']));
      }
    }
  }

  // Filter out enabled modules.
  $enabled = array_filter($install, 'module_exists');
  $install = array_diff($install, $enabled);
  if (!empty($install)) {

    // Make sure the install API is available.
    $install = array_unique($install);
    include_once DRUPAL_ROOT . '/' . './includes/install.inc';
    module_enable($install);
  }
}