You are here

public function ConfigPartialExportForm::createArchive in Config Partial Export 8

Creates a tarball based on $change_list.

Creates a tarball based on $change_list in the temporary directory set on admin/config/media/file-system page.

Parameters

array $change_list: Array of modified config files.

bool $add_system_site_info: If TRUE the system.site.yml file will be added to change list.

1 call to ConfigPartialExportForm::createArchive()
ConfigPartialExportForm::submitForm in src/Form/ConfigPartialExportForm.php
Form submission handler.

File

src/Form/ConfigPartialExportForm.php, line 218

Class

ConfigPartialExportForm
Construct the storage changes in a configuration synchronization form.

Namespace

Drupal\config_partial_export\Form

Code

public function createArchive(array $change_list, $add_system_site_info = FALSE) {
  $this->fileSystem
    ->delete($this->fileSystem
    ->getTempDirectory() . '/config_partial.tar.gz');
  $archiver = new ArchiveTar($this->fileSystem
    ->getTempDirectory() . '/config_partial.tar.gz', 'gz');

  // Get raw configuration data without overrides.
  if ($add_system_site_info && !in_array('system.site', $change_list)) {
    $change_list[] = 'system.site';
  }
  foreach ($change_list as $name) {
    $yaml = Yaml::encode($this->configManager
      ->getConfigFactory()
      ->get($name)
      ->getRawData());
    $archiver
      ->addString("{$name}.yml", $yaml);
  }
}