drupal_check_profile

drupal_check_profile($profile)

Checks an installation profile's requirements.

Parameters

string $profile: Name of installation profile to check.

Return value

array Array of the installation profile's requirements.

File

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

Code

function drupal_check_profile($profile) {
  $info = install_profile_info($profile);
  // Collect requirement testing results.
  $requirements = array();
  // Performs an ExtensionDiscovery scan as the system module is unavailable and
  // we don't yet know where all the modules are located.
  // @todo Remove as part of https://www.drupal.org/node/2186491
  $drupal_root = \Drupal::root();
  $module_list = (new ExtensionDiscovery($drupal_root))->scan('module');

  foreach ($info['dependencies'] as $module) {
    // If the module is in the module list we know it exists and we can continue
    // including and registering it.
    // @see \Drupal\Core\Extension\ExtensionDiscovery::scanDirectory()
    if (isset($module_list[$module])) {
      $function = $module . '_requirements';
      $module_path = $module_list[$module]->getPath();
      $install_file = "$drupal_root/$module_path/$module.install";

      if (is_file($install_file)) {
        require_once $install_file;
      }

      drupal_classloader_register($module, $module_path);

      if (function_exists($function)) {
        $requirements = array_merge($requirements, $function('install'));
      }
    }
  }

  return $requirements;
}
doc_Drupal
2016-10-29 09:03:10
Comments
Leave a Comment

Please login to continue.