You are here

public function SolrFieldTypeController::getConfigZip in Search API Solr 8.2

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

Provides a zip archive containing a complete Solr configuration.

Parameters

\Drupal\search_api\ServerInterface $search_api_server:

Return value

array A render array as expected by drupal_render().

1 string reference to 'SolrFieldTypeController::getConfigZip'
search_api_solr.routing.yml in ./search_api_solr.routing.yml
search_api_solr.routing.yml

File

src/Controller/SolrFieldTypeController.php, line 76

Class

SolrFieldTypeController
Provides different listings of SolrFieldType.

Namespace

Drupal\search_api_solr\Controller

Code

public function getConfigZip(ServerInterface $search_api_server) {
  @ob_clean();
  try {

    /** @var \ZipStream\ZipStream $zip */
    $zip = $this
      ->getListBuilder($search_api_server)
      ->getConfigZip();
    $zip
      ->finish();
    @ob_end_flush();
    exit;
  } catch (\Exception $e) {
    watchdog_exception('search_api', $e);
    \Drupal::messenger()
      ->addError($this
      ->t('An error occured during the creation of the config.zip. Look at the logs for details.'));
  }
  return [];
}