You are here

function _drd_server_count_watchdog in Drupal Remote Dashboard Server 7.2

Same name and namespace in other branches
  1. 6.2 drd_server.module \_drd_server_count_watchdog()

Callback to count the number of watchdog entries of a given severity in a given period of time.

Parameters

string $severity: The severity of records to be counted.

int $period: The period in seconds in the past relative to now for which the records should be counted.

Return value

int The number of records being available.

1 call to _drd_server_count_watchdog()
drd_server_heartbeat in ./drd_server.module
Callback to retrieve lots of current runtime data form the domain.

File

./drd_server.module, line 1266
Provides XMLRPC implementation to respond to requests from DRD.

Code

function _drd_server_count_watchdog($severity, $period) {
  if (!module_exists('dblog')) {
    return 0;
  }
  $query = db_select('watchdog');
  $query
    ->addExpression('COUNT(wid)', 'count');
  $query
    ->condition('severity', $severity);
  if ($period) {
    $query
      ->condition('timestamp', REQUEST_TIME - $period, '>=');
  }
  return $query
    ->execute()
    ->fetchField();
}