You are here

function raven_libraries_load in Raven: Sentry Integration 7.2

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

Loads Sentry PHP library.

Return value

bool Returns TRUE if libraries loaded or FALSE otherwise.

1 call to raven_libraries_load()
raven_get_client in ./raven.module
Returns the Sentry PHP client instance, or NULL if it could not be created.

File

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

Code

function raven_libraries_load() {
  $library['loaded'] = FALSE;
  if (class_exists('Raven_Client')) {
    $library['loaded'] = TRUE;
  }
  elseif (function_exists('composer_autoloader') && composer_autoloader() && class_exists('Raven_Client')) {
    $library['loaded'] = TRUE;
  }
  elseif (module_exists('libraries')) {
    $library = libraries_load('sentry-php');
  }
  if (!$library['loaded']) {

    // This function can be called multiple times, so prevent multiple messages.
    drupal_set_message(t('Sentry PHP library cannot be loaded. Check status report for more details.'), 'warning', FALSE);
  }
  return (bool) $library['loaded'];
}