function jsonlog_default_site_id in JSONlog 7.2
Same name and namespace in other branches
- 8.2 jsonlog.inc \jsonlog_default_site_id()
- 8 jsonlog.inc \jsonlog_default_site_id()
- 7 jsonlog.inc \jsonlog_default_site_id()
- 3.x jsonlog.inc \jsonlog_default_site_id()
Establish default site ID.
Server's hostname + __ + (default) database name. If default database also has a prefix: + __ + database prefix.
Return value
string
3 calls to jsonlog_default_site_id()
- jsonlog_test_filing in ./jsonlog.inc 
- Checks if log dir+file exists and is writable, and logs to watchdog.
- jsonlog_watchdog in ./jsonlog.module 
- Logs any watchdog call - at or above a certain severity threshold - as JSON to a custom log file.
- _jsonlog_form_system_logging_settings_alter in ./jsonlog.inc 
- Adds this module's setting fields to the system logging settings form.
File
- ./jsonlog.inc, line 16 
- JSONlog module helper functions.
Code
function jsonlog_default_site_id() {
  if ($site_id = getenv('drupal_jsonlog_siteid')) {
    return $site_id;
  }
  // Server's hostname + database name + database prefix (if any).
  $db =& $GLOBALS['databases']['default']['default'];
  $site_id = drupal_strtolower(preg_replace('/[^\\w\\d\\.\\-_]/', '-', gethostname())) . '__' . $db['database'] . (!$db['prefix'] ? '' : '__' . $db['prefix']);
  unset($db);
  // Clear ref.
  return $site_id;
}