function _social_finalise_batch in Open Social 8.2
Same name and namespace in other branches
- 8 social.profile \_social_finalise_batch()
- 8.3 social.profile \_social_finalise_batch()
- 8.4 social.profile \_social_finalise_batch()
- 8.5 social.profile \_social_finalise_batch()
- 8.6 social.profile \_social_finalise_batch()
- 8.7 social.profile \_social_finalise_batch()
Implements callback_batch_operation().
Performs batch finalising.
1 string reference to '_social_finalise_batch'
- social_final_site_setup in ./
social.profile - Final setup of Social profile.
File
- ./
social.profile, line 440 - Enables modules and site configuration for a social site installation.
Code
function _social_finalise_batch($process, $description, &$context) {
switch ($process) {
case 'profile_weight':
$profile = drupal_get_profile();
// Installation profiles are always loaded last.
module_set_weight($profile, 1000);
break;
case 'router_rebuild':
// Build the router once after installing all modules.
// This would normally happen upon KernelEvents::TERMINATE, but since the
// installer does not use an HttpKernel, that event is never triggered.
\Drupal::service('router.builder')
->rebuild();
break;
case 'trigger_sapi_index':
$indexes = Index::loadMultiple();
/** @var \Drupal\search_api\Entity\Index $index */
foreach ($indexes as $index) {
$index
->reindex();
}
break;
case 'cron_run':
// Run cron to populate update status tables (if available) so that users
// will be warned if they've installed an out of date Drupal version.
// Will also trigger indexing of profile-supplied content or feeds.
\Drupal::service('cron')
->run();
break;
case 'import_optional_config':
// We need to import all the optional configuration as well, since
// this is not supported by Drupal Core installation profiles yet.
/** @var \Drupal\features\FeaturesAssignerInterface $assigner */
$assigner = \Drupal::service('features_assigner');
$bundle = $assigner
->applyBundle('social');
if ($bundle
->getMachineName() === 'social') {
$current_bundle = $bundle;
/** @var \Drupal\features\FeaturesManagerInterface $manager */
$manager = \Drupal::service('features.manager');
$packages = $manager
->getPackages();
$packages = $manager
->filterPackages($packages, $current_bundle
->getMachineName());
$options = [];
foreach ($packages as $package) {
if ($package
->getStatus() != FeaturesManagerInterface::STATUS_NO_EXPORT) {
$missing = $manager
->reorderMissing($manager
->detectMissing($package));
$overrides = $manager
->detectOverrides($package, TRUE);
if (!empty($overrides) || !empty($missing)) {
$options += [
$package
->getMachineName() => [],
];
}
}
}
/** @var \Drupal\features\FeaturesManagerInterface $manager */
$manager = \Drupal::service('features.manager');
$packages = $manager
->getPackages();
$packages = $manager
->filterPackages($packages, 'social');
$overridden = [];
foreach ($packages as $package) {
$overrides = $manager
->detectOverrides($package);
$missing = $manager
->detectMissing($package);
if ((!empty($missing) || !empty($overrides)) && $package
->getStatus() == FeaturesManagerInterface::STATUS_INSTALLED) {
$overridden[] = $package
->getMachineName();
}
}
if (!empty($overridden)) {
social_features_import($overridden);
}
}
break;
}
$context['results'][] = $process;
$context['message'] = $description;
}