You are here

public function Updater::commit in Automatic Updates 8.2

Commits the current update.

File

src/Updater.php, line 196

Class

Updater
Defines a service to perform updates.

Namespace

Drupal\automatic_updates

Code

public function commit() : void {
  $active_dir = $this->pathLocator
    ->getActiveDirectory();
  $active_composer = ComposerUtility::createForDirectory($active_dir);
  $stage_dir = $this->pathLocator
    ->getStageDirectory();
  $stage_composer = ComposerUtility::createForDirectory($stage_dir);

  /** @var \Drupal\automatic_updates\Event\PreCommitEvent $event */
  $event = $this
    ->dispatchUpdateEvent(new PreCommitEvent($active_composer, $stage_composer), AutomaticUpdatesEvents::PRE_COMMIT);
  $this->committer
    ->commit($stage_dir, $active_dir, $this
    ->getExclusions($event));
  $this
    ->dispatchUpdateEvent(new UpdateEvent($active_composer), AutomaticUpdatesEvents::POST_COMMIT);
}