You are here

function apachesolr_config_file in Apache Solr Search 7

Same name and namespace in other branches
  1. 8 apachesolr.admin.inc \apachesolr_config_file()
  2. 6.3 apachesolr.admin.inc \apachesolr_config_file()
  3. 6 apachesolr.admin.inc \apachesolr_config_file()
  4. 6.2 apachesolr.admin.inc \apachesolr_config_file()

Page callback to show one conf file.

Parameters

string $name:

array $environment:

Return value

string the requested config file

1 string reference to 'apachesolr_config_file'
apachesolr_menu in ./apachesolr.module
Implements hook_menu().

File

./apachesolr.admin.inc, line 842
Administrative pages for the Apache Solr framework.

Code

function apachesolr_config_file($name, array $environment = array()) {
  if (empty($environment)) {
    $env_id = apachesolr_default_environment();
  }
  else {
    $env_id = $environment['env_id'];
  }
  $output = '';
  try {
    $solr = apachesolr_get_solr($env_id);
    $response = $solr
      ->makeServletRequest('admin/file', array(
      'file' => $name,
    ));
    $raw_file = $response->data;
    $output = '<pre>' . check_plain($raw_file) . '</pre>';
    drupal_set_title(check_plain($name));
  } catch (Exception $e) {
    apachesolr_log_exception($env_id, $e);
    drupal_set_message(nl2br(check_plain($e
      ->getMessage())), "warning");
  }
  return $output;
}