You are here

public function ExportEntityWriter::archiveFiles in Content Synchronizer 8.2

Same name and namespace in other branches
  1. 8 src/Processors/ExportEntityWriter.php \Drupal\content_synchronizer\Processors\ExportEntityWriter::archiveFiles()
  2. 3.x src/Processors/ExportEntityWriter.php \Drupal\content_synchronizer\Processors\ExportEntityWriter::archiveFiles()

Zip the generated files.

File

src/Processors/ExportEntityWriter.php, line 153

Class

ExportEntityWriter
Export entity writer.

Namespace

Drupal\content_synchronizer\Processors

Code

public function archiveFiles() {
  $path = \Drupal::service('file_system')
    ->realpath($this
    ->getDirPath());
  $archivePath = $path . static::EXPORT_EXTENSION;

  /** @var \Drupal\Core\File\FileSystemInterface $fileSystem */
  $fileSystem = \Drupal::service('file_system');
  $fileSystem
    ->delete($archivePath);
  $archiver = new ArchiveTar($archivePath, 'gz');
  $this
    ->addRepToArchive($path, '', $archiver);
}