function features_install_modules in Features 6
Same name and namespace in other branches
- 7.2 features.module \features_install_modules()
- 7 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 - Implementation of 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 436 - 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 = module_rebuild_cache();
// Build maximal list of dependencies.
$install = array();
foreach ($modules as $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 './includes/install.inc';
drupal_install_modules($install);
}
}