You are here

protected function InPlaceUpdate::doRestore in Automatic Updates 8

Do restore.

Parameters

\SplFileInfo $file: File to restore.

string $project_root: The project root directory.

1 call to InPlaceUpdate::doRestore()
InPlaceUpdate::rollback in src/Services/InPlaceUpdate.php
Rollback after a failed update.

File

src/Services/InPlaceUpdate.php, line 484

Class

InPlaceUpdate
Class to apply in-place updates.

Namespace

Drupal\automatic_updates\Services

Code

protected function doRestore(\SplFileInfo $file, $project_root) {
  $file_real_path = $this
    ->getFileRealPath($file);
  $file_path = substr($file_real_path, strlen($this->backup));
  try {
    $this->fileSystem
      ->copy($file_real_path, $this
      ->getProjectRealPath($file_path, $project_root), FileSystemInterface::EXISTS_REPLACE);
    $this->logger
      ->info('"@file" was successfully restored.', [
      '@file' => $file_path,
    ]);
  } catch (FileException $exception) {
    $this->logger
      ->error('"@file" failed restoration during rollback.', [
      '@file' => $file_real_path,
    ]);
  }
}