You are here

public function SolrConnectorPluginBase::getFile in Search API Solr 8

Same name and namespace in other branches
  1. 8.3 src/SolrConnector/SolrConnectorPluginBase.php \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::getFile()
  2. 8.2 src/SolrConnector/SolrConnectorPluginBase.php \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::getFile()
  3. 4.x src/SolrConnector/SolrConnectorPluginBase.php \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::getFile()

Retrieves a config file or file list from the Solr server.

Uses the admin/file request handler.

Parameters

string|null $file: (optional) The name of the file to retrieve. If the file is a directory, the directory contents are instead listed and returned. NULL represents the root config directory.

Return value

\Solarium\Core\Client\Response A Solarium response object containing either the file contents or a file list.

Overrides SolrConnectorInterface::getFile

File

src/SolrConnector/SolrConnectorPluginBase.php, line 962

Class

SolrConnectorPluginBase
Defines a base class for Solr connector plugins.

Namespace

Drupal\search_api_solr\SolrConnector

Code

public function getFile($file = NULL) {
  $this
    ->connect();
  $query = $this->solr
    ->createPing();
  $query
    ->setHandler('admin/file');
  $query
    ->addParam('contentType', 'text/xml;charset=utf-8');
  if ($file) {
    $query
      ->addParam('file', $file);
  }
  return $this
    ->execute($query)
    ->getResponse();
}