You are here

protected function SearchApiSolrConnection::setSystemInfo in Search API Solr 7

Call the /admin/system servlet to retrieve system information.

Stores the retrieved information in $system_info.

See also

getSystemInfo()

1 call to SearchApiSolrConnection::setSystemInfo()
SearchApiSolrConnection::getSystemInfo in includes/solr_connection.inc
Implements SearchApiSolrConnectionInterface::getSystemInfo().

File

includes/solr_connection.inc, line 305

Class

SearchApiSolrConnection
Represents a Solr server resource.

Code

protected function setSystemInfo() {
  $cid = $this
    ->getCacheId(__FUNCTION__);
  if ($cid) {
    $cache = cache_get($cid, 'cache_search_api_solr');
    if ($cache) {
      $this->system_info = json_decode($cache->data);
    }
  }

  // Second pass to populate the cache if necessary.
  if (empty($this->system_info)) {
    $url = $this
      ->constructUrl(self::SYSTEM_SERVLET, array(
      'wt' => 'json',
    ));
    $response = $this
      ->sendRawGet($url);
    $this->system_info = json_decode($response->data);
    if ($cid) {
      cache_set($cid, $response->data, 'cache_search_api_solr');
    }
  }
}