function raven_requirements in Raven: Sentry Integration 8.2
Same name and namespace in other branches
- 8 raven.install \raven_requirements()
- 7.4 raven.install \raven_requirements()
- 7 raven.install \raven_requirements()
- 7.2 raven.install \raven_requirements()
- 7.3 raven.install \raven_requirements()
- 3.x raven.install \raven_requirements()
Implements hook_requirements().
File
- ./
raven.install, line 11 - Requirements for Raven module.
Code
function raven_requirements($phase) {
$requirements['raven_library']['title'] = t('Sentry PHP');
if (class_exists('Raven_Client')) {
$requirements['raven_library']['value'] = Raven_Client::VERSION;
if ($phase == 'runtime' && ($client = \Drupal::service('logger.raven')->client)) {
if ($client->environment) {
$requirements['raven_environment'] = [
'title' => t('Sentry environment'),
'value' => $client->environment,
];
}
if ($client->release) {
$requirements['raven_release'] = [
'title' => t('Sentry release'),
'value' => $client->release,
];
}
}
}
else {
$requirements['raven_library']['description'] = t('Sentry PHP library version 1.x is required by Raven module, but is not available. Run <code>composer require drupal/raven</code> to install dependencies automatically (or <code>composer require sentry/sentry:^1</code> to install the missing library only).');
$requirements['raven_library']['severity'] = REQUIREMENT_ERROR;
$requirements['raven_library']['value'] = t('Not found');
}
$requirements['raven_curl']['title'] = t('cURL');
if (function_exists('curl_init')) {
$requirements['raven_curl']['value'] = t('Enabled');
}
else {
$requirements['raven_curl']['description'] = t('Raven module could not be installed because the PHP <a href=":curl_url">cURL</a> extension is not available.', [
':curl_url' => 'https://php.net/manual/curl.setup.php',
]);
$requirements['raven_curl']['severity'] = REQUIREMENT_ERROR;
$requirements['raven_curl']['value'] = t('Not found');
}
$requirements['raven_trace']['title'] = t('Sentry reflection tracing');
if (\Drupal::config('raven.settings')
->get('trace')) {
$requirements['raven_trace']['description'] = t('Sentry reflection tracing is enabled, which may result in sensitive data being logged by Sentry.');
$requirements['raven_trace']['value'] = t('Enabled');
}
else {
$requirements['raven_trace']['value'] = t('Disabled');
}
return $requirements;
}