function config_installer_install_uninstalled_profile_dependencies in Configuration installer 8
Ensures all profile dependencies are created.
Parameters
array $context.: The batch context.
\Drupal\Core\Config\ConfigImporter $config_importer: The config importer.
See also
1 string reference to 'config_installer_install_uninstalled_profile_dependencies'
- config_install_batch in ./
config_installer.profile - Creates a batch for the config importer to process.
File
- ./
config_installer.profile, line 191 - Enables modules and site configuration for a minimal site installation.
Code
function config_installer_install_uninstalled_profile_dependencies(array &$context, ConfigImporter $config_importer) {
if (!array_key_exists('missing_profile_dependencies', $context)) {
$profile = _config_installer_get_original_install_profile();
$profile_file = drupal_get_path('profile', $profile) . "/{$profile}.info.yml";
$info = \Drupal::service('info_parser')
->parse($profile_file);
$dependencies = isset($info['dependencies']) ? $info['dependencies'] : [];
$context['missing_profile_dependencies'] = array_diff($dependencies, array_keys(\Drupal::moduleHandler()
->getModuleList()));
if (count($context['missing_profile_dependencies']) === 0) {
$context['finished'] = 1;
return;
}
// @todo Need to dependency sort them...
}
$still_missing = array_diff($context['missing_profile_dependencies'], array_keys(\Drupal::moduleHandler()
->getModuleList()));
if (!empty($still_missing)) {
$missing_module = array_shift($still_missing);
// This is not a config sync module install... fun!
\Drupal::service('config.installer')
->setSyncing(FALSE);
\Drupal::service('module_installer')
->install([
$missing_module,
]);
$context['message'] = t('Installed @module. This will be uninstalled after the profile has been installed.', [
'@module' => $missing_module,
]);
}
$context['finished'] = (count($context['missing_profile_dependencies']) - count($still_missing)) / count($context['missing_profile_dependencies']);
}