drupal_install_profile

5 install.inc drupal_install_profile($profile, $module_list)

Install a profile (i.e. a set of modules) from scratch. The profile must be verified first using drupal_verify_profile().

Parameters

profile: The name of the profile to install.

module_list: An array of modules to install.

1 call to drupal_install_profile()

File

includes/install.inc, line 304

Code

function drupal_install_profile($profile, $module_list) {
  // The system module is a special case; we can't bootstrap until it's
  // installed, so we can't use the normal installation function.
  $module_list = array_diff($module_list, array('system'));

  $system_path = dirname(drupal_get_filename('module', 'system', NULL));
  require_once './' . $system_path . '/system.install';
  module_invoke('system', 'install');
  $system_versions = drupal_get_schema_versions('system');
  $system_version = $system_versions ? max($system_versions) : SCHEMA_INSTALLED;
  db_query("INSERT INTO {system} (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES('%s', '%s', 'module', '', 1, 0, 0, %d)", $system_path . '/system.module', 'system', $system_version);

  // Now that we've installed things properly, bootstrap the full Drupal environment
  drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

  // Install schemas for profile and all its modules.
  module_rebuild_cache();
  drupal_install_modules($module_list);

  // And now, run the profile's install function.
  $function = $profile . '_install';
  if (function_exists($function)) {
    $function();
  }
}
Login or register to post comments