diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 7c48116..890ba14 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -524,22 +524,24 @@ function install_run_task($task, &$install_state) { // already. $current_batch = \Drupal::state()->get('install_current_batch'); if (!$install_state['interactive'] || !$current_batch) { - $batch = $function($install_state); - if (empty($batch)) { + $batches = $function($install_state); + if (empty($batches)) { // If the task did some processing and decided no batch was necessary, // there is nothing more to do here. return; } - batch_set($batch); - // For interactive batches, we need to store the fact that this batch - // task is currently running. Otherwise, we need to make sure the batch - // will complete in one page request. - if ($install_state['interactive']) { - \Drupal::state()->set('install_current_batch', $function); - } - else { - $batch =& batch_get(); - $batch['progressive'] = FALSE; + foreach ($batches as $batch) { + batch_set($batch); + // For interactive batches, we need to store the fact that this batch + // task is currently running. Otherwise, we need to make sure the batch + // will complete in one page request. + if ($install_state['interactive']) { + \Drupal::state()->set('install_current_batch', $function); + } + else { + $batch =& batch_get(); + $batch['progressive'] = FALSE; + } } // Process the batch. For progressive batches, this will redirect. // Otherwise, the batch will complete. @@ -725,18 +727,12 @@ function install_tasks($install_state) { // Finish by adding the remaining core tasks. $tasks += array( - 'install_import_translations_remaining' => array( + 'install_finish_translations' => array( 'display_name' => t('Finish translations'), 'display' => $needs_translations, 'type' => 'batch', 'run' => $needs_translations ? INSTALL_TASK_RUN_IF_NOT_COMPLETED : INSTALL_TASK_SKIP, ), - 'install_update_configuration_translations' => array( - 'display_name' => t('Translate configuration'), - 'display' => $needs_translations, - 'type' => 'batch', - 'run' => $needs_translations ? INSTALL_TASK_RUN_IF_NOT_COMPLETED : INSTALL_TASK_SKIP, - ), 'install_finished' => array( ), ); @@ -1469,7 +1465,7 @@ function install_bootstrap_full() { * An array of information about the current installation state. * * @return - * The batch definition. + * An array containing the batch definition. */ function install_profile_modules(&$install_state) { $modules = \Drupal::state()->get('install_profile_modules') ?: array(); @@ -1506,12 +1502,13 @@ function install_profile_modules(&$install_state) { foreach ($required + $non_required as $module => $weight) { $operations[] = array('_install_module_batch', array($module, $files[$module]->info['name'])); } - $batch = array( + $batches = array(); + $batches[] = array( 'operations' => $operations, 'title' => t('Installing @drupal', array('@drupal' => drupal_install_profile_distribution_name())), 'error_message' => t('The installation has encountered an error.'), ); - return $batch; + return $batches; } /** @@ -1592,7 +1589,7 @@ function install_download_additional_translations_operations(&$install_state) { * An array of information about the current installation state. * * @return - * The batch definition, if there are language files to import. + * An array containing the batch definition, if there are language files to import. */ function install_import_translations(&$install_state) { \Drupal::moduleHandler()->loadInclude('locale', 'translation.inc'); @@ -1622,7 +1619,7 @@ function install_import_translations(&$install_state) { 'finished' => 'locale_translation_batch_fetch_finished', 'file' => drupal_get_path('module', 'locale') . '/locale.batch.inc', ); - return $batch; + return array($batch); } } @@ -1679,10 +1676,12 @@ function _install_prepare_import($langcodes, $server_pattern) { * @param $install_state * An array of information about the current installation state. * - * @return - * The batch definition, if there are language files to import. + * @return array + * An array of batch definitions. + * + * @see install_tasks() */ -function install_import_translations_remaining(&$install_state) { +function install_finish_translations(&$install_state) { \Drupal::moduleHandler()->loadInclude('locale', 'fetch.inc'); \Drupal::moduleHandler()->loadInclude('locale', 'compare.inc'); @@ -1690,30 +1689,19 @@ function install_import_translations_remaining(&$install_state) { // installed, their translations will be downloaded (if required) and imported // using a batch. $projects = locale_translation_build_projects(); + $batches = array(); if (count($projects) > 1) { $options = _locale_translation_default_update_options(); $languages = \Drupal::languageManager()->getLanguages(); - if ($batch = locale_translation_batch_update_build(array(), array_keys($languages), $options)) { - return $batch; + if ($batch = locale_translation_batch_update_build(array(), array($install_state['parameters']['langcode']), $options)) { + $batches[] = $batch; } } -} - -/** - * Creates configuration translations. - * - * @param array $install_state - * An array of information about the current installation state. - * - * @return array - * The batch definition, if there are configuration objects to update. - * - * @see install_tasks() - */ -function install_update_configuration_translations(&$install_state) { + + // Creates configuration translations. \Drupal::moduleHandler()->loadInclude('locale', 'bulk.inc'); - $languages = \Drupal::languageManager()->getLanguages(); - return locale_config_batch_update_components(array(), array_keys($languages)); + $batches[] = locale_config_batch_update_components(array(), array($install_state['parameters']['langcode'])); + return $batches; } /**