You are here

function raven_libraries_load in Raven: Sentry Integration 7

Same name and namespace in other branches
  1. 7.2 raven.module \raven_libraries_load()
  2. 7.3 raven.module \raven_libraries_load()

Loads Sentry PHP and Raven.js libraries.

Return value

boolean Returns TRUE if libraries loaded or FALSE otherwise.

2 calls to raven_libraries_load()
raven_watchdog in ./raven.module
Implements hook_watchdog().
_raven_get_client in ./raven.module
Returns an instance of the Raven PHP client.

File

./raven.module, line 464
Allows to track errors to Sentry server.

Code

function raven_libraries_load() {
  static $message_sent = FALSE, $message_sent_js = FALSE;
  $library = libraries_load('sentry-php');

  // This function can be called multiple times, so prevent multiple messages.
  if (!$library['loaded'] && !$message_sent) {
    drupal_set_message(t('Sentry PHP library cannot be loaded. Check <a href="@url">reports</a> for more details.', array(
      '@url' => url('admin/reports/status'),
    )), 'warning');
    $message_sent = TRUE;
  }
  $library_js['loaded'] = TRUE;
  if (variable_get('raven_js_enabled', FALSE) && variable_get('raven_js_source', 'cdn') == 'library') {
    $library_js = libraries_load('raven-js');
    if (!$library_js['loaded'] && !$message_sent_js) {
      drupal_set_message(t('Raven.js library cannot be loaded. Check <a href="@url">settings</a>.', array(
        '@url' => url('admin/config/development/raven'),
      )), 'warning');
      $message_sent_js = TRUE;
    }
  }
  return (bool) $library['loaded'] && $library_js['loaded'];
}