You are here

protected function FeaturesGenerationArchive::generatePackage in Features 8.4

Same name and namespace in other branches
  1. 8.3 src/Plugin/FeaturesGeneration/FeaturesGenerationArchive.php \Drupal\features\Plugin\FeaturesGeneration\FeaturesGenerationArchive::generatePackage()

Writes a package or profile's files to an archive.

Parameters

array &$return: The return value, passed by reference.

\Drupal\features\Package $package: The package or profile.

\Drupal\Core\Archiver\ArchiveTar $archiver: The archiver.

1 call to FeaturesGenerationArchive::generatePackage()
FeaturesGenerationArchive::generate in src/Plugin/FeaturesGeneration/FeaturesGenerationArchive.php
Performs package generation.

File

src/Plugin/FeaturesGeneration/FeaturesGenerationArchive.php, line 201

Class

FeaturesGenerationArchive
Class for generating a compressed archive of packages.

Namespace

Drupal\features\Plugin\FeaturesGeneration

Code

protected function generatePackage(array &$return, Package $package, ArchiveTar $archiver) {
  $success = TRUE;
  foreach ($package
    ->getFiles() as $file) {
    try {
      $this
        ->generateFile($package
        ->getDirectory(), $file, $archiver);
    } catch (\Exception $exception) {
      $this
        ->failure($return, $package, $exception);
      $success = FALSE;
      break;
    }
  }
  if ($success) {
    $this
      ->success($return, $package);
  }
}