public function SolrFieldTypeController::getConfigZip in Search API Solr 8.3
Same name and namespace in other branches
- 8.2 src/Controller/SolrFieldTypeController.php \Drupal\search_api_solr\Controller\SolrFieldTypeController::getConfigZip()
- 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: The Search API server entity.
Return value
array|void A render array as expected by drupal_render().
File
- src/
Controller/ SolrFieldTypeController.php, line 30
Class
- SolrFieldTypeController
- Provides different listings of SolrFieldType.
Namespace
Drupal\search_api_solr\ControllerCode
public function getConfigZip(ServerInterface $search_api_server) {
try {
$archive_options = new Archive();
$archive_options
->setSendHttpHeaders(TRUE);
@ob_clean();
// If you are using nginx as a webserver, it will try to buffer the
// response. We have to disable this with a custom header.
// @see https://github.com/maennchen/ZipStream-PHP/wiki/nginx
header('X-Accel-Buffering: no');
$zip = $this
->getListBuilder($search_api_server)
->getConfigZip($archive_options);
$zip
->finish();
@ob_end_flush();
exit;
} catch (\Exception $e) {
watchdog_exception('search_api', $e);
$this->messenger
->addError($this
->t('An error occured during the creation of the config.zip. Look at the logs for details.'));
}
return [];
}