diff --git a/core/modules/config/src/Form/ConfigSync.php b/core/modules/config/src/Form/ConfigSync.php index 7bb098e..05d3de5 100644 --- a/core/modules/config/src/Form/ConfigSync.php +++ b/core/modules/config/src/Form/ConfigSync.php @@ -7,7 +7,6 @@ namespace Drupal\config\Form; -use Drupal\Core\Config\ConfigImporter; use Drupal\Core\Config\ConfigManagerInterface; use Drupal\Core\Form\FormBase; use Drupal\Core\Config\StorageInterface; @@ -59,7 +58,7 @@ class ConfigSync extends FormBase { protected $renderer; /** - * The key value storer. + * The key value store. * * @var \Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface; */ @@ -262,59 +261,4 @@ public function submitForm(array &$form, FormStateInterface $form_state) { // Redirect to the confirmation form. $form_state->setRedirect('config.sync_confirm'); } - - /** - * Processes the config import batch and persists the importer. - * - * @param \Drupal\Core\Config\ConfigImporter $config_importer - * The batch config importer object to persist. - * @param string $sync_step - * The synchronization step to do. - * @param array $context - * The batch context. - */ - public static function processBatch(ConfigImporter $config_importer, $sync_step, &$context) { - if (!isset($context['sandbox']['config_importer'])) { - $context['sandbox']['config_importer'] = $config_importer; - } - - $config_importer = $context['sandbox']['config_importer']; - $config_importer->doSyncStep($sync_step, $context); - if ($errors = $config_importer->getErrors()) { - if (!isset($context['results']['errors'])) { - $context['results']['errors'] = array(); - } - $context['results']['errors'] += $errors; - } - } - - /** - * Finish batch. - * - * This function is a static function to avoid serializing the ConfigSync - * object unnecessarily. - */ - public static function finishBatch($success, $results, $operations) { - if ($success) { - if (!empty($results['errors'])) { - foreach ($results['errors'] as $error) { - drupal_set_message($error, 'error'); - \Drupal::logger('config_sync')->error($error); - } - drupal_set_message(\Drupal::translation()->translate('The configuration was imported with errors.'), 'warning'); - } - else { - drupal_set_message(\Drupal::translation()->translate('The configuration was imported successfully.')); - } - } - else { - // An error occurred. - // $operations contains the operations that remained unprocessed. - $error_operation = reset($operations); - $message = \Drupal::translation()->translate('An error occurred while processing %error_operation with arguments: @arguments', array('%error_operation' => $error_operation[0], '@arguments' => print_r($error_operation[1], TRUE))); - drupal_set_message($message, 'error'); - } - } - - } diff --git a/core/modules/config/src/Form/ConfigSyncConfirmForm.php b/core/modules/config/src/Form/ConfigSyncConfirmForm.php index dfbe7a5..771ac8c 100644 --- a/core/modules/config/src/Form/ConfigSyncConfirmForm.php +++ b/core/modules/config/src/Form/ConfigSyncConfirmForm.php @@ -247,10 +247,18 @@ public static function processBatch(ConfigImporter $config_importer, $sync_step, } /** - * Finish batch. + * Implements callback_batch_finished(). * + * Performs post-processing for submitForm(). * This function is a static function to avoid serializing the ConfigSync * object unnecessarily. + * + * @param bool $success + * A boolean indicating whether the sync process has completed. + * @param array $results + * An array of results information. + * @param array $operations + * An array of function calls. */ public static function finishBatch($success, $results, $operations) { if ($success) {