function apachesolr_config_files_overview in Apache Solr Search 6
Same name and namespace in other branches
- 8 apachesolr.admin.inc \apachesolr_config_files_overview()
- 6.3 apachesolr.admin.inc \apachesolr_config_files_overview()
- 6.2 apachesolr.admin.inc \apachesolr_config_files_overview()
- 7 apachesolr.admin.inc \apachesolr_config_files_overview()
Page callback to show available conf files.
1 string reference to 'apachesolr_config_files_overview'
- apachesolr_menu in ./
apachesolr.module - Implementation of hook_menu().
File
- ./
apachesolr.admin.inc, line 717 - Administrative pages for the Apache Solr framework.
Code
function apachesolr_config_files_overview() {
$output = '';
$xml = NULL;
try {
$solr = apachesolr_get_solr();
$response = $solr
->makeServletRequest('admin/file', array(
'wt' => 'xml',
));
$xml = simplexml_load_string($response
->getRawResponse());
} catch (Exception $e) {
watchdog('Apache Solr', nl2br(check_plain($e
->getMessage())), NULL, WATCHDOG_ERROR);
drupal_set_message(nl2br(check_plain($e
->getMessage())), "warning");
}
if ($xml) {
$files = $xml
->xpath('//lst[@name="files"]/lst');
$items = array();
foreach ($files as $file) {
$atr = $file
->attributes();
$name = (string) $atr[0];
$str = l($name, 'admin/reports/apachesolr/conf/' . $name);
$str .= '<br />' . format_date(strtotime((string) $file->date));
$str .= '<br />' . t('Size (bytes): @bytes', array(
'@bytes' => (string) $file->long,
));
$items[$name] = $str;
}
ksort($items);
$output .= theme('item_list', array_values($items));
}
return $output;
}