function configuration_check_module_dependencies in Configuration Management 6
Check if all the module dependencies are available
Parameters
$modules: array of module names
$update_list: if TRUE, add all the dependecies to pattern's module list
Return value
empty array if all dependencies are available array of missing module's names if some dependencies are not available
1 call to configuration_check_module_dependencies()
- configuration_enable_modules in ./
configuration.module - Enable all of the provided modules
File
- ./
configuration.module, line 2054 - Provide a unified method for defining site configurations abstracted from their data format. Various data formats should be supported via a plugin architecture such as XML, YAML, JSON, PHP
Code
function configuration_check_module_dependencies(&$modules, $update_list = FALSE) {
if (empty($modules)) {
return array();
}
$modules_info = module_rebuild_cache();
$result = array();
$dependencies = array();
foreach ($modules as $module) {
$module = is_array($module) ? $module['value'] : $module;
if (array_key_exists($module, $modules_info)) {
// check also for module's dependencies
foreach ($modules_info[$module]->info['dependencies'] as $dependency) {
if (array_key_exists($dependency, $modules_info)) {
$dependencies[] = $dependency;
}
else {
$result[] = $dependency;
}
}
}
else {
$result[] = $module;
}
}
if ($update_list && empty($result) && !empty($dependencies)) {
$modules = array_unique(array_merge($modules, $dependencies));
}
return $result;
}