You are here

function patterns_install_modules in Patterns 6

Same name and namespace in other branches
  1. 6.2 patterns.module \patterns_install_modules()
  2. 7.2 includes/core/modules.inc \patterns_install_modules()
  3. 7 includes/core/modules.inc \patterns_install_modules()
1 call to patterns_install_modules()
patterns_execute_pattern_batch in ./patterns.module

File

./patterns.module, line 1433
Enables extremely simple adding/removing features to your site with minimal to no configuration

Code

function patterns_install_modules(&$modules) {
  $result = array(
    'success' => TRUE,
  );
  if (empty($modules)) {
    return $result;
  }
  $missing = patterns_check_module_dependencies($modules, TRUE);
  if (!empty($missing)) {
    $result['success'] = FALSE;
    $result['error_message'] = t('Following required modules are missing: %modules', array(
      '%modules' => implode(', ', $missing),
    ));
    $result['missing_modules'] = $missing;
    return $result;
  }
  require_once './includes/install.inc';
  drupal_install_modules($modules);
  module_rebuild_cache();
  $result['installed_modules'] = $modules;
  return $result;
}