You are here

public function ExportEntityWriter::archiveFiles in Content Synchronizer 3.x

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

Zip the generated files.

File

src/Processors/ExportEntityWriter.php, line 171

Class

ExportEntityWriter
Export entity writer.

Namespace

Drupal\content_synchronizer\Processors

Code

public function archiveFiles() {

  /** @var \Drupal\Core\File\FileSystem $fileSystem */
  $fileSystem = \Drupal::service('file_system');
  $path = $fileSystem
    ->realpath($this
    ->getDirPath());
  $archivePath = $path . static::EXPORT_EXTENSION;
  if (file_exists($archivePath)) {
    $fileSystem
      ->delete($archivePath);
  }
  $archiver = new ArchiveTar($archivePath, 'gz');
  $this
    ->addRepToArchive($path, '', $archiver);
}