function RecipeCommand::rollBackToCheckpoint

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Recipe/RecipeCommand.php \Drupal\Core\Recipe\RecipeCommand::rollBackToCheckpoint()
  2. 10 core/lib/Drupal/Core/Recipe/RecipeCommand.php \Drupal\Core\Recipe\RecipeCommand::rollBackToCheckpoint()

Rolls config back to a particular checkpoint.

Parameters

\Drupal\Core\Config\Checkpoint\Checkpoint $checkpoint: The checkpoint to roll back to.

1 call to RecipeCommand::rollBackToCheckpoint()
RecipeCommand::execute in core/lib/Drupal/Core/Recipe/RecipeCommand.php

File

core/lib/Drupal/Core/Recipe/RecipeCommand.php, line 161

Class

RecipeCommand
Applies recipe.

Namespace

Drupal\Core\Recipe

Code

private function rollBackToCheckpoint(Checkpoint $checkpoint) : void {
  $container = \Drupal::getContainer();
  /** @var \Drupal\Core\Config\Checkpoint\CheckpointStorageInterface $checkpoint_storage */
  $checkpoint_storage = $container->get('config.storage.checkpoint');
  $checkpoint_storage->setCheckpointToReadFrom($checkpoint);
  $storage_comparer = new StorageComparer($checkpoint_storage, $container->get('config.storage'));
  $storage_comparer->reset();
  $container->get(ConfigImporterFactory::class)
    ->get($storage_comparer)
    ->import();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.