function gelf_require in GELF 7
Same name and namespace in other branches
- 8 gelf.module \gelf_require()
Include gelf-php library.
Return value
boolean
3 calls to gelf_require()
- gelf_form_system_logging_settings_alter in ./
gelf.module - Implements hook_form_FORM_ID_alter().
- gelf_requirements in ./
gelf.install - Implements hook_requirements().
- gelf_watchdog in ./
gelf.module - Implement hook_watchdog().
File
- ./
gelf.module, line 100 - gelf.module
Code
function gelf_require() {
// Check if the classes already exist and allow existing autoloaders.
if (class_exists('GELFMessage') && class_exists('GELFMessagePublisher')) {
return TRUE;
}
// Check module for Composer autoload file.
if (@(include_once dirname(__FILE__) . '/vendor/autoload.php')) {
return TRUE;
}
// Use Libraries API to load it.
if (function_exists('libraries_get_path')) {
$gelfmsg_path = libraries_get_path('gelf-php') . '/GELFMessage.php';
$gelfpub_path = libraries_get_path('gelf-php') . '/GELFMessagePublisher.php';
// Check if the php-gelf library is available
if (file_exists(DRUPAL_ROOT . '/' . $gelfmsg_path) && file_exists(DRUPAL_ROOT . '/' . $gelfpub_path)) {
require_once DRUPAL_ROOT . '/' . $gelfmsg_path;
require_once DRUPAL_ROOT . '/' . $gelfpub_path;
return TRUE;
}
}
return FALSE;
}