function drush_check_module_dependencies

8.0.x environment_7.inc drush_check_module_dependencies($modules, $module_info)
8.0.x environment_6.inc drush_check_module_dependencies($modules, $module_info)
8.0.x environment.inc drush_check_module_dependencies($modules, $module_info)
6.x environment_6.inc drush_check_module_dependencies($modules, $module_info)
6.x environment.inc drush_check_module_dependencies($modules, $module_info)
6.x environment_7.inc drush_check_module_dependencies($modules, $module_info)
7.x environment_7.inc drush_check_module_dependencies($modules, $module_info)
7.x environment_6.inc drush_check_module_dependencies($modules, $module_info)
7.x environment.inc drush_check_module_dependencies($modules, $module_info)
3.x environment_7.inc drush_check_module_dependencies($modules, $module_info)
3.x environment_6.inc drush_check_module_dependencies($modules, $module_info)
3.x environment_5.inc drush_check_module_dependencies($modules, $module_info)
4.x environment_6.inc drush_check_module_dependencies($modules, $module_info)
4.x environment_5.inc drush_check_module_dependencies($modules, $module_info)
4.x environment.inc drush_check_module_dependencies($modules, $module_info)
5.x environment_6.inc drush_check_module_dependencies($modules, $module_info)
5.x environment.inc drush_check_module_dependencies($modules, $module_info)
master environment_7.inc drush_check_module_dependencies($modules, $module_info)
master environment.inc drush_check_module_dependencies($modules, $module_info)

Return dependencies and its status for modules.

Parameters

$modules: Array of module names

$module_info: Drupal 'files' array for modules as returned by drush_get_modules().

Return value

Array with dependencies and status for $modules

1 call to drush_check_module_dependencies()
drush_pm_enable in commands/pm/pm.drush.inc
Command callback. Enable one or more projects.

File

commands/core/drupal/environment_7.inc, line 30
Specific functions for a drupal 5 environment. drush_include_engine() magically includes either this file or environment_X.inc depending on which version of drupal drush is called from.

Code

function drush_check_module_dependencies($modules, $module_info) {
  $status = array();
  foreach ($modules as $key => $module) {
    $dependencies = $module_info[$module]->requires;
    $unmet_dependencies = array_diff(array_keys($dependencies), array_keys($module_info));
    if (!empty($unmet_dependencies)) {
      $status[$key]['error'] = array(
        'code' => 'DRUSH_PM_ENABLE_DEPENDENCY_NOT_FOUND',
        'message' => dt('Module !module cannot be enabled because it depends on the following modules which could not be found: !unmet_dependencies', array('!module' => $module, '!unmet_dependencies' => implode(',', $unmet_dependencies))),
      );
    }
    else {
      // check for version incompatibility
      foreach ($dependencies as $dependency_name => $v) {
        $current_version = $module_info[$dependency_name]->info['version'];
        $incompatibility = drupal_check_incompatibility($v, $current_version);
        if (!is_null($incompatibility)) {
          $status[$key]['error'] = array(
            'code' => 'DRUSH_PM_ENABLE_DEPENDENCY_VERSION_MISMATCH',
            'message' => dt('Module !module cannot be enabled because it depends on !dependency !required_version but !current_version is available', array('!module' => $module, '!dependency' => $dependency_name, '!required_version' => $incompatibility, '!current_version' => $current_version)),
          );
        }
      }
    }
    $status[$key]['dependencies'] = array_keys($dependencies);
  }

  return $status;
}