You are here

function install_profile_info in Drupal 7

Same name and namespace in other branches
  1. 8 core/includes/install.inc \install_profile_info()
  2. 9 core/includes/install.inc \install_profile_info()
  3. 10 core/includes/install.inc \install_profile_info()

Retrieves information about an installation profile from its .info file.

The information stored in a profile .info file is similar to that stored in a normal Drupal module .info file. For example:

  • name: The real name of the installation profile for display purposes.
  • description: A brief description of the profile.
  • dependencies: An array of shortnames of other modules that this install profile requires.

Additional, less commonly-used information that can appear in a profile.info file but not in a normal Drupal module .info file includes:

  • distribution_name: The name of the Drupal distribution that is being installed, to be shown throughout the installation process. Defaults to 'Drupal'.
  • exclusive: If the install profile is intended to be the only eligible choice in a distribution, setting exclusive = TRUE will auto-select it during installation, and the install profile selection screen will be skipped. If more than one profile is found where exclusive = TRUE then this property will have no effect and the profile selection screen will be shown as normal with all available profiles shown.

Note that this function does an expensive file system scan to get info file information for dependencies. If you only need information from the info file itself, use system_get_info().

Example of .info file:


   name = Minimal
   description = Start fresh, with only a few modules enabled.
   dependencies[] = block
   dependencies[] = dblog

Parameters

$profile: Name of profile.

$locale: Name of locale used (if any).

Return value

The info array.

7 calls to install_profile_info()
DrupalWebTestCase::setUp in modules/simpletest/drupal_web_test_case.php
Sets up a Drupal site for running functional and integration tests.
drupal_check_profile in includes/install.inc
Checks an installation profile's requirements.
install_load_profile in includes/install.core.inc
Loads information about the chosen profile during installation.
install_select_profile_form in includes/install.core.inc
Form constructor for the profile selection form.
ModuleUnitTest::testDependencyResolution in modules/simpletest/tests/module.test
Test dependency resolution.

... See full list

File

includes/install.inc, line 1288
API functions for installing modules and themes.

Code

function install_profile_info($profile, $locale = 'en') {
  $cache =& drupal_static(__FUNCTION__, array());
  if (!isset($cache[$profile])) {

    // Set defaults for module info.
    $defaults = array(
      'dependencies' => array(),
      'description' => '',
      'distribution_name' => 'Drupal',
      'version' => NULL,
      'hidden' => FALSE,
      'php' => DRUPAL_MINIMUM_PHP,
    );
    $info = drupal_parse_info_file("profiles/{$profile}/{$profile}.info") + $defaults;
    $info['dependencies'] = array_unique(array_merge(drupal_required_modules(), $info['dependencies'], $locale != 'en' && !empty($locale) ? array(
      'locale',
    ) : array()));

    // drupal_required_modules() includes the current profile as a dependency.
    // Since a module can't depend on itself we remove that element of the array.
    array_shift($info['dependencies']);
    $cache[$profile] = $info;
  }
  return $cache[$profile];
}