You are here

protected function DrupalApacheSolrService::setSystemInfo in Apache Solr Search 8

Same name and namespace in other branches
  1. 6.3 Drupal_Apache_Solr_Service.php \DrupalApacheSolrService::setSystemInfo()
  2. 7 Drupal_Apache_Solr_Service.php \DrupalApacheSolrService::setSystemInfo()

Call the /admin/system servlet

Return value

(array) With all the system info

1 call to DrupalApacheSolrService::setSystemInfo()
DrupalApacheSolrService::getSystemInfo in ./Drupal_Apache_Solr_Service.php
Get information about the Solr Core.

File

./Drupal_Apache_Solr_Service.php, line 173

Class

DrupalApacheSolrService
Starting point for the Solr API. Represents a Solr server resource and has methods for pinging, adding, deleting, committing, optimizing and searching.

Code

protected function setSystemInfo() {
  $url = $this
    ->_constructUrl(self::SYSTEM_SERVLET, array(
    'wt' => 'json',
  ));
  if ($this->env_id) {
    $this->system_info_cid = $this->env_id . ":system:" . drupal_hash_base64($url);
    $cache = cache_get($this->system_info_cid, 'cache_apachesolr');
    if (isset($cache->data)) {
      $this->system_info = json_decode($cache->data);
    }
  }

  // Second pass to populate the cache if necessary.
  if (empty($this->system_info)) {
    $response = $this
      ->_sendRawGet($url);
    $this->system_info = json_decode($response->data);
    if ($this->env_id) {
      cache_set($this->system_info_cid, $response->data, 'cache_apachesolr');
    }
  }
}