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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.