You are here

public function SolrConfigSetController::getConfigZip in Search API Solr 8.3

Same name and namespace in other branches
  1. 4.x src/Controller/SolrConfigSetController.php \Drupal\search_api_solr\Controller\SolrConfigSetController::getConfigZip()

Returns a ZipStream of all configuration files.

Parameters

\ZipStream\Option\Archive $archive_options: Archive options.

Return value

\ZipStream\ZipStream The ZipStream that contains all configuration files.

Throws

\Drupal\search_api\SearchApiException

\ZipStream\Exception\FileNotFoundException

\ZipStream\Exception\FileNotReadableException

1 call to SolrConfigSetController::getConfigZip()
SolrConfigSetController::streamConfigZip in src/Controller/SolrConfigSetController.php
Streams a zip archive containing a complete Solr configuration.

File

src/Controller/SolrConfigSetController.php, line 323

Class

SolrConfigSetController
Provides different listings of SolrFieldType.

Namespace

Drupal\search_api_solr\Controller

Code

public function getConfigZip(Archive $archive_options) : ZipStream {

  /** @var \Drupal\search_api_solr\SolrBackendInterface $backend */
  $backend = $this
    ->getBackend();
  $connector = $backend
    ->getSolrConnector();
  $solr_branch = $connector
    ->getSolrBranch($this->assumedMinimumVersion);
  $zip = new ZipStream('solr_' . $solr_branch . '_config.zip', $archive_options);
  $files = $this
    ->getConfigFiles();
  foreach ($files as $name => $content) {
    $zip
      ->addFile($name, $content);
  }
  return $zip;
}