function drupal_verify_profile in Drupal 7
Same name and namespace in other branches
- 8 core/includes/install.inc \drupal_verify_profile()
- 5 includes/install.inc \drupal_verify_profile()
- 6 includes/install.inc \drupal_verify_profile()
- 9 core/includes/install.inc \drupal_verify_profile()
Verifies an installation profile for installation.
Parameters
$install_state: An array of information about the current installation state.
Return value
The list of modules to install.
1 call to drupal_verify_profile()
- install_verify_requirements in includes/
install.core.inc - Verifies the requirements for installing Drupal.
File
- includes/
install.inc, line 678 - API functions for installing modules and themes.
Code
function drupal_verify_profile($install_state) {
$profile = $install_state['parameters']['profile'];
$locale = $install_state['parameters']['locale'];
include_once DRUPAL_ROOT . '/includes/file.inc';
include_once DRUPAL_ROOT . '/includes/common.inc';
$profile_file = DRUPAL_ROOT . "/profiles/{$profile}/{$profile}.profile";
if (!isset($profile) || !file_exists($profile_file)) {
throw new Exception(install_no_profile_error());
}
$info = $install_state['profile_info'];
// Get a list of modules that exist in Drupal's assorted subdirectories.
$present_modules = array();
foreach (drupal_system_listing('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\\.module$/', 'modules', 'name', 0) as $present_module) {
$present_modules[] = $present_module->name;
}
// The installation profile is also a module, which needs to be installed
// after all the other dependencies have been installed.
$present_modules[] = drupal_get_profile();
// Verify that all of the profile's required modules are present.
$missing_modules = array_diff($info['dependencies'], $present_modules);
$requirements = array();
if (count($missing_modules)) {
$modules = array();
foreach ($missing_modules as $module) {
$modules[] = '<span class="admin-missing">' . drupal_ucfirst($module) . '</span>';
}
$requirements['required_modules'] = array(
'title' => st('Required modules'),
'value' => st('Required modules not found.'),
'severity' => REQUIREMENT_ERROR,
'description' => st('The following modules are required but were not found. Move them into the appropriate modules subdirectory, such as <em>sites/all/modules</em>. Missing modules: !modules', array(
'!modules' => implode(', ', $modules),
)),
);
}
return $requirements;
}