1 install.inc backdrop_verify_profile($install_state)

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.:

Throws

Exception

File

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

Code

function backdrop_verify_profile($install_state) {
  include_once BACKDROP_ROOT . '/core/includes/file.inc';
  include_once BACKDROP_ROOT . '/core/includes/common.inc';

  $profile = $install_state['parameters']['profile'];
  $profile_file = _install_find_profile_file($profile);

  if (!isset($profile) || !$profile_file) {
    throw new Exception(install_no_profile_error());
  }
  $info = $install_state['profile_info'];

  // Get a list of modules that exist in Backdrop's assorted subdirectories.
  $present_modules = array();
  foreach (backdrop_system_listing('/^' . BACKDROP_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[] = $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">' . backdrop_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>/modules</em>. Missing modules: !modules', array('!modules' => implode(', ', $modules))),);
  }
  return $requirements;
}