function apachesolr_requirements in Apache Solr Search 5
Same name and namespace in other branches
- 8 apachesolr.install \apachesolr_requirements()
- 5.2 apachesolr.install \apachesolr_requirements()
- 6.3 apachesolr.install \apachesolr_requirements()
- 6 apachesolr.install \apachesolr_requirements()
- 6.2 apachesolr.install \apachesolr_requirements()
- 7 apachesolr.install \apachesolr_requirements()
Implementation of hook_requirements().
1 call to apachesolr_requirements()
File
- ./
apachesolr.module, line 147 - Integration with the Apache Solr search application.
Code
function apachesolr_requirements($phase) {
// Ensure translations don't break at install time
$t = get_t();
if ($phase == 'runtime') {
$host = variable_get('apachesolr_host', 'localhost');
$port = variable_get('apachesolr_port', 8983);
$path = variable_get('apachesolr_path', '/solr');
$ping = FALSE;
try {
$solr =& apachesolr_get_solr($host, $port, $path);
$ping = @$solr
->ping();
// If there is no $solr object, there is no server available, so don't continue.
if (!$ping) {
throw new Exception(t('No Solr instance available during indexing'));
}
} catch (Exception $e) {
watchdog('Apache Solr', $e
->getMessage(), WATCHDOG_ERROR);
}
$value = $ping ? $t('Solr can be pinged.') : $t('No Solr instance is available.');
$severity = $ping ? 0 : 2;
$description = theme('item_list', array(
$t('Host: %host', array(
'%host' => $host,
)),
$t('Port: %port', array(
'%port' => $port,
)),
$t('Path: %path', array(
'%path' => $path,
)),
));
$requirements['apachesolr'] = array(
'title' => $t('ApacheSolr'),
'value' => $value,
'description' => $description,
'severity' => $severity,
);
return $requirements;
}
}