You are here

raven.install in Raven: Sentry Integration 8.2

Requirements for Raven module.

File

raven.install
View source
<?php

/**
 * @file
 * Requirements for Raven module.
 */

/**
 * Implements hook_requirements().
 */
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;
}

/**
 * Remove obsolete polyfill_promise config.
 */
function raven_update_8201() {
  \Drupal::configFactory()
    ->getEditable('raven.settings')
    ->clear('polyfill_promise')
    ->save();
}

Functions

Namesort descending Description
raven_requirements Implements hook_requirements().
raven_update_8201 Remove obsolete polyfill_promise config.